Subject: [PATCH links] Adding test to ensure export functionality is covered.

From: Peter Sanchez <[email-masked]>
Date: Tue, 30 Dec 2025 07:45:42 -0600

---
 core/routes_test.go | 83 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)

diff --git a/core/routes_test.go b/core/routes_test.go
index 70eff34..3a98712 100644
--- a/core/routes_test.go
+++ b/core/routes_test.go
@@ -798,4 +798,87 @@ func TestHandlers(t *testing.T) {
 		// Verify the form is shown (indicating error handling)
 		c.True(len(htmlBody) > 0)
 	})
+
+	t.Run("export data", func(t *testing.T) {
+		baseURL := &models.BaseURL{URL: "http://export-test.com"}
+		err := baseURL.Store(dbCtx)
+		c.NoError(err)
+
+		orgLink := &models.OrgLink{
+			Title:      "Export Test Link",
+			URL:        "http://export-test.com",
+			BaseURLID:  baseURL.ID,
+			OrgID:      1,
+			UserID:     1,
+			Visibility: models.OrgLinkVisibilityPublic,
+			Type:       models.OrgLinkType,
+		}
+		err = orgLink.Store(dbCtx)
+		c.NoError(err)
+
+		noteBaseURL := &models.BaseURL{URL: "http://export-note-test.com"}
+		err = noteBaseURL.Store(dbCtx)
+		c.NoError(err)
+
+		note := &models.OrgLink{
+			Title:      "Export Test Note",
+			BaseURLID:  noteBaseURL.ID,
+			OrgID:      1,
+			UserID:     1,
+			Type:       models.NoteType,
+			Visibility: models.OrgLinkVisibilityPublic,
+		}
+		err = note.Store(dbCtx)
+		c.NoError(err)
+
+		linkShort := &models.LinkShort{
+			Title:     "Export Test Short",
+			URL:       "http://short-test.com",
+			ShortCode: "exp1",
+			DomainID:  1,
+			OrgID:     1,
+			UserID:    1,
+		}
+		err = linkShort.Store(dbCtx)
+		c.NoError(err)
+
+		listing := &models.Listing{
+			Title:    "Export Test Listing",
+			Slug:     "export-test-listing",
+			DomainID: 2,
+			OrgID:    1,
+			UserID:   1,
+			IsActive: true,
+		}
+		err = listing.Store(dbCtx)
+		c.NoError(err)
+
+		listingLink := &models.ListingLink{
+			Title:     "Export Test Listing Link",
+			ListingID: listing.ID,
+			URL:       "http://listing-link-test.com",
+			UserID:    1,
+			LinkOrder: 1,
+		}
+		err = listingLink.Store(dbCtx)
+		c.NoError(err)
+
+		f := make(url.Values)
+		f.Set("format", "0")
+		request := httptest.NewRequest(http.MethodPost, "/personal-org/export", strings.NewReader(f.Encode()))
+		request.Header.Set(echo.HeaderContentType, echo.MIMEApplicationForm)
+		recorder := httptest.NewRecorder()
+		ctx := &server.Context{
+			Server:  srv,
+			Context: e.NewContext(request, recorder),
+			User:    loggedInUser,
+		}
+		ctx.SetPath("/:slug/export")
+		ctx.SetParamNames("slug")
+		ctx.SetParamValues("personal-org")
+		err = test.MakeRequestWithDomain(srv, coreService.ExportData, ctx, domains[0])
+		c.NoError(err)
+		c.Equal(http.StatusOK, recorder.Code)
+		c.Equal("application/json", recorder.Header().Get("Content-Type"))
+	})
 }
-- 
2.52.0

---

From: "Peter Sanchez" <[email-masked]>
Date: Tue, 30 Dec 2025 12:45:47 -0600

Applied.

To [email-masked]:~netlandish/links
   6ddf2e8..e7d2ee2  master -> master