Skip to content

Every analytics tool wants a subscription. And your data. I built Twiligent instead. YouTube stats. Instagram stats. One dashboard. Runs locally on your machine.

refactor(tests): move frontend tests into frontend/tests

spacesdrive3a04b56279e9
diff --git a/frontend/package.json b/frontend/package.json
index 80f84d1..edb816b 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -8,7 +8,7 @@
"build": "vite build",
"lint": "eslint .",
"preview": "vite preview",
- "test": "node --test \"src/**/*.test.js\""
+ "test": "node --test \"tests/**/*.test.js\""
},
"dependencies": {
"@base-ui/react": "^1.5.0",
diff --git a/frontend/src/docs/nav.test.js b/frontend/tests/docs/nav.test.js
similarity index 84%
rename from frontend/src/docs/nav.test.js
rename to frontend/tests/docs/nav.test.js
index 3212c19..a5c06bb 100644
--- a/frontend/src/docs/nav.test.js
+++ b/frontend/tests/docs/nav.test.js
@@ -1,8 +1,8 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
-import { ALL_DOC_PAGES, neighbours, tabForPath } from './nav.js';
-import { DOC_ROUTE_SLUGS } from './routes.js';
-import { slugify } from './slug.js';
+import { ALL_DOC_PAGES, neighbours, tabForPath } from '../../src/docs/nav.js';
+import { DOC_ROUTE_SLUGS } from '../../src/docs/routes.js';
+import { slugify } from '../../src/docs/slug.js';
test('every page in the navigation has a route, and every route is in the navigation', () => {
const navSlugs = ALL_DOC_PAGES.map(p => p.slug).sort();
diff --git a/frontend/src/docs/pages/selfHost/selfHostSql.test.js b/frontend/tests/docs/pages/selfHost/selfHostSql.test.js
similarity index 88%
rename from frontend/src/docs/pages/selfHost/selfHostSql.test.js
rename to frontend/tests/docs/pages/selfHost/selfHostSql.test.js
index eb9e6e7..d2a7bfa 100644
--- a/frontend/src/docs/pages/selfHost/selfHostSql.test.js
+++ b/frontend/tests/docs/pages/selfHost/selfHostSql.test.js
@@ -1,6 +1,6 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
-import { SCHEMA_SQL, RLS_SQL, UPGRADE_SQL } from './selfHostSql.js';
+import { SCHEMA_SQL, RLS_SQL, UPGRADE_SQL } from '../../../../src/docs/pages/selfHost/selfHostSql.js';
const tablesIn = sql => [...sql.matchAll(/create table (\w+)/g)].map(match => match[1]);
const secured = sql => [...sql.matchAll(/alter table (\w+) enable row level security;/g)].map(match => match[1]);
diff --git a/frontend/src/features/accounts/accountManagerData.test.js b/frontend/tests/features/accounts/accountManagerData.test.js
similarity index 97%
rename from frontend/src/features/accounts/accountManagerData.test.js
rename to frontend/tests/features/accounts/accountManagerData.test.js
index 88c7be2..ddf66ce 100644
--- a/frontend/src/features/accounts/accountManagerData.test.js
+++ b/frontend/tests/features/accounts/accountManagerData.test.js
@@ -2,7 +2,7 @@ import { test } from 'node:test';
import assert from 'node:assert/strict';
import {
TESTER_HINT, instagramErrorMessage, readOAuthReturn, accountMetrics, accountCardHandle, visibleSections,
-} from './accountManagerData.js';
+} from '../../../src/features/accounts/accountManagerData.js';
const params = query => new URLSearchParams(query);
diff --git a/frontend/src/features/analytics/channel/channelChartData.test.js b/frontend/tests/features/analytics/channel/channelChartData.test.js
similarity index 98%
rename from frontend/src/features/analytics/channel/channelChartData.test.js
rename to frontend/tests/features/analytics/channel/channelChartData.test.js
index 919cec7..801e86a 100644
--- a/frontend/src/features/analytics/channel/channelChartData.test.js
+++ b/frontend/tests/features/analytics/channel/channelChartData.test.js
@@ -4,7 +4,7 @@ import {
watchUrl, channelMeta, dayDataOf, hourDataOf, durationDataOf, categoryDataOf, splitDataOf, shortsComparisonOf,
topVideosChartOf, topVideoRowsOf, viewRangeDataOf, uploadsByMonthOf, rateOf, likesPerComment, peakHourLabel,
bestVideosOf, likesLabel,
-} from './channelChartData.js';
+} from '../../../../src/features/analytics/channel/channelChartData.js';
test('watch links point at YouTube', () => {
assert.equal(watchUrl('abc'), 'https://www.youtube.com/watch?v=abc');
diff --git a/frontend/src/features/analytics/instagram/instagramAnalyticsData.test.js b/frontend/tests/features/analytics/instagram/instagramAnalyticsData.test.js
similarity index 96%
rename from frontend/src/features/analytics/instagram/instagramAnalyticsData.test.js
rename to frontend/tests/features/analytics/instagram/instagramAnalyticsData.test.js
index e8e2794..e01272c 100644
--- a/frontend/src/features/analytics/instagram/instagramAnalyticsData.test.js
+++ b/frontend/tests/features/analytics/instagram/instagramAnalyticsData.test.js
@@ -3,7 +3,7 @@ import assert from 'node:assert/strict';
import {
typeRowsOf, contentMixOf, topPostsChartOf, dayOfWeekDataOf, timelineDataOf, instagramChartsOf, followerRatio,
typeViewsSubtitle, reportedViews,
-} from './instagramAnalyticsData.js';
+} from '../../../../src/features/analytics/instagram/instagramAnalyticsData.js';
const typeStats = {
reel: { count: 3, avgLikes: 10, viewsReported: 3, totalViews: 4500, avgViews: 1500 },
diff --git a/frontend/src/features/analytics/overview/greeting.test.js b/frontend/tests/features/analytics/overview/greeting.test.js
similarity index 90%
rename from frontend/src/features/analytics/overview/greeting.test.js
rename to frontend/tests/features/analytics/overview/greeting.test.js
index 905a69c..2a3e028 100644
--- a/frontend/src/features/analytics/overview/greeting.test.js
+++ b/frontend/tests/features/analytics/overview/greeting.test.js
@@ -1,6 +1,6 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
-import { greeting, greetingName, greetingTitle } from './greeting.js';
+import { greeting, greetingName, greetingTitle } from '../../../../src/features/analytics/overview/greeting.js';
const atHour = hour => new Date(2026, 0, 1, hour, 30);
diff --git a/frontend/src/features/analytics/overview/overviewCharts.test.js b/frontend/tests/features/analytics/overview/overviewCharts.test.js
similarity index 97%
rename from frontend/src/features/analytics/overview/overviewCharts.test.js
rename to frontend/tests/features/analytics/overview/overviewCharts.test.js
index 31a5324..9317596 100644
--- a/frontend/src/features/analytics/overview/overviewCharts.test.js
+++ b/frontend/tests/features/analytics/overview/overviewCharts.test.js
@@ -3,7 +3,7 @@ import assert from 'node:assert/strict';
import {
CATEGORY_SERIES, audienceChartDataOf, audienceLegendOf, audienceDotColor, commentByContentOf, engagementByContentOf,
categoryViewDataOf, commentByCategoryOf, karmaByAccountOf,
-} from './overviewCharts.js';
+} from '../../../../src/features/analytics/overview/overviewCharts.js';
const groups = {
youtube: [{ title: 'A channel with a long name', subscriberCount: 10 }],
diff --git a/frontend/src/features/analytics/overview/overviewLabels.test.js b/frontend/tests/features/analytics/overview/overviewLabels.test.js
similarity index 98%
rename from frontend/src/features/analytics/overview/overviewLabels.test.js
rename to frontend/tests/features/analytics/overview/overviewLabels.test.js
index 5383287..af37521 100644
--- a/frontend/src/features/analytics/overview/overviewLabels.test.js
+++ b/frontend/tests/features/analytics/overview/overviewLabels.test.js
@@ -3,7 +3,7 @@ import assert from 'node:assert/strict';
import {
countLabel, overviewDescription, syncDetail, metricTabsOf, igTypeSummary, categoryMeta, topContentLabel,
accountAudienceLabel, accountContentLabel,
-} from './overviewLabels.js';
+} from '../../../../src/features/analytics/overview/overviewLabels.js';
const channel = { id: 'y1', viewCount: 5000, videoCount: 10, subscriberCount: 100 };
const igAccount = { id: 'i1', platform: 'instagram', mediaCount: 20, followersCount: 300 };
diff --git a/frontend/src/features/analytics/overview/overviewStats.test.js b/frontend/tests/features/analytics/overview/overviewStats.test.js
similarity index 95%
rename from frontend/src/features/analytics/overview/overviewStats.test.js
rename to frontend/tests/features/analytics/overview/overviewStats.test.js
index f5d8e98..f48a4cb 100644
--- a/frontend/src/features/analytics/overview/overviewStats.test.js
+++ b/frontend/tests/features/analytics/overview/overviewStats.test.js
@@ -2,8 +2,8 @@ import { test } from 'node:test';
import assert from 'node:assert/strict';
import {
accountTotalsOf, cacheTotalsOf, summaryOf, sortedByAudience, sortedByContent, sortedByChannelViews, igAccountRowsOf,
-} from './overviewStats.js';
-import { trackedStatsOf } from './overviewTrackedStats.js';
+} from '../../../../src/features/analytics/overview/overviewStats.js';
+import { trackedStatsOf } from '../../../../src/features/analytics/overview/overviewTrackedStats.js';
const channel = { id: 'y1', platform: 'youtube', title: 'Studio', subscriberCount: 100, viewCount: 5000, videoCount: 10 };
const legacyYt = { id: 'y2', title: 'Legacy', subscriberCount: 50, viewCount: 9000, videoCount: 4 };
diff --git a/frontend/src/features/analytics/overview/overviewTrackedStats.test.js b/frontend/tests/features/analytics/overview/overviewTrackedStats.test.js
similarity index 90%
rename from frontend/src/features/analytics/overview/overviewTrackedStats.test.js
rename to frontend/tests/features/analytics/overview/overviewTrackedStats.test.js
index 6faadc5..7ed6cf8 100644
--- a/frontend/src/features/analytics/overview/overviewTrackedStats.test.js
+++ b/frontend/tests/features/analytics/overview/overviewTrackedStats.test.js
@@ -1,6 +1,6 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
-import { trackedStatsOf, categoryStatsOf } from './overviewTrackedStats.js';
+import { trackedStatsOf, categoryStatsOf } from '../../../../src/features/analytics/overview/overviewTrackedStats.js';
const tracked = [
{ contentType: 'youtube', viewCount: 1000, likeCount: 10, commentCount: 4, category: 'Tech' },
diff --git a/frontend/src/features/analytics/reddit/redditAnalyticsData.test.js b/frontend/tests/features/analytics/reddit/redditAnalyticsData.test.js
similarity index 95%
rename from frontend/src/features/analytics/reddit/redditAnalyticsData.test.js
rename to frontend/tests/features/analytics/reddit/redditAnalyticsData.test.js
index 31d8f99..fa38288 100644
--- a/frontend/src/features/analytics/reddit/redditAnalyticsData.test.js
+++ b/frontend/tests/features/analytics/reddit/redditAnalyticsData.test.js
@@ -2,7 +2,7 @@ import { test } from 'node:test';
import assert from 'node:assert/strict';
import {
mediaTypeDataOf, karmaSummaryOf, postingFrequencyRows, karmaBreakdownRows, performanceIndicators,
-} from './redditAnalyticsData.js';
+} from '../../../../src/features/analytics/reddit/redditAnalyticsData.js';
const labels = { text: 'Text', image: 'Image', video: 'Video', link: 'Link' };
diff --git a/frontend/src/features/analytics/reels/reelsLibrary.test.js b/frontend/tests/features/analytics/reels/reelsLibrary.test.js
similarity index 97%
rename from frontend/src/features/analytics/reels/reelsLibrary.test.js
rename to frontend/tests/features/analytics/reels/reelsLibrary.test.js
index ccc012c..894675b 100644
--- a/frontend/src/features/analytics/reels/reelsLibrary.test.js
+++ b/frontend/tests/features/analytics/reels/reelsLibrary.test.js
@@ -2,7 +2,7 @@ import { test } from 'node:test';
import assert from 'node:assert/strict';
import {
mergeAccountMedia, typeTotalsOf, viewTotalsOf, filterAndSortMedia, typeViewsSubtitle, reelsDescription,
-} from './reelsLibrary.js';
+} from '../../../../src/features/analytics/reels/reelsLibrary.js';
const accounts = [{ id: 'i1', title: 'Paper Fold' }, { id: 'i2', username: 'second' }, { id: 'i3' }];
diff --git a/frontend/src/features/analytics/shorts/shortsLibrary.test.js b/frontend/tests/features/analytics/shorts/shortsLibrary.test.js
similarity index 97%
rename from frontend/src/features/analytics/shorts/shortsLibrary.test.js
rename to frontend/tests/features/analytics/shorts/shortsLibrary.test.js
index 346e1cf..4232255 100644
--- a/frontend/src/features/analytics/shorts/shortsLibrary.test.js
+++ b/frontend/tests/features/analytics/shorts/shortsLibrary.test.js
@@ -1,6 +1,6 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
-import { shortsOf, filterAndSortShorts, shortsDescription } from './shortsLibrary.js';
+import { shortsOf, filterAndSortShorts, shortsDescription } from '../../../../src/features/analytics/shorts/shortsLibrary.js';
const videos = [
{ videoId: 's1', channelId: 'c1', title: 'Quick pasta', durationSeconds: 45, viewCount: 900, likeCount: 5, publishedAt: '2026-02-01T00:00:00Z' },
diff --git a/frontend/src/features/analytics/tracked/trackedCategoryStats.test.js b/frontend/tests/features/analytics/tracked/trackedCategoryStats.test.js
similarity index 97%
rename from frontend/src/features/analytics/tracked/trackedCategoryStats.test.js
rename to frontend/tests/features/analytics/tracked/trackedCategoryStats.test.js
index 98182da..3f577f5 100644
--- a/frontend/src/features/analytics/tracked/trackedCategoryStats.test.js
+++ b/frontend/tests/features/analytics/tracked/trackedCategoryStats.test.js
@@ -3,7 +3,7 @@ import assert from 'node:assert/strict';
import {
youtubeStatsOf, redditStatsOf, sortedByViews, sortedByKarma, chartDataOf, platformSplit, categoryDescription,
itemsSubtitle, viewsMetric, karmaMetric, commentsSubtitle, redditViewsMetric, upvoteRatioLabel,
-} from './trackedCategoryStats.js';
+} from '../../../../src/features/analytics/tracked/trackedCategoryStats.js';
const videos = [
{ id: 'y1', contentType: 'youtube', title: 'A very long video title here', viewCount: 2000, likeCount: 100, commentCount: 7 },
diff --git a/frontend/src/features/analytics/tracked/trackedList.test.js b/frontend/tests/features/analytics/tracked/trackedList.test.js
similarity index 98%
rename from frontend/src/features/analytics/tracked/trackedList.test.js
rename to frontend/tests/features/analytics/tracked/trackedList.test.js
index 8c6cf44..9b712cc 100644
--- a/frontend/src/features/analytics/tracked/trackedList.test.js
+++ b/frontend/tests/features/analytics/tracked/trackedList.test.js
@@ -3,7 +3,7 @@ import assert from 'node:assert/strict';
import {
SORT_OPTIONS, filterAndSortTracked, categoriesOf, trackedStatsOf, typeChipsOf, pluralize, countLabel,
bulkCategoryMessage, parseManualViews, imageFileError, MAX_IMAGE_BYTES,
-} from './trackedList.js';
+} from '../../../../src/features/analytics/tracked/trackedList.js';
const items = [
{ id: 'r1', title: 'Cat post', subreddit: 'cats', score: 50, numComments: 4, manualViews: 900, category: 'Pets', createdAt: '2030-01-02' },
diff --git a/frontend/src/features/analytics/videos/videoLibrary.test.js b/frontend/tests/features/analytics/videos/videoLibrary.test.js
similarity index 97%
rename from frontend/src/features/analytics/videos/videoLibrary.test.js
rename to frontend/tests/features/analytics/videos/videoLibrary.test.js
index 0697129..ffc9b8c 100644
--- a/frontend/src/features/analytics/videos/videoLibrary.test.js
+++ b/frontend/tests/features/analytics/videos/videoLibrary.test.js
@@ -1,6 +1,6 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
-import { watchUrl, filterAndSortVideos, videoStatsOf, nextSort, ariaSortOf, videosDescription, mergeChannelVideos } from './videoLibrary.js';
+import { watchUrl, filterAndSortVideos, videoStatsOf, nextSort, ariaSortOf, videosDescription, mergeChannelVideos } from '../../../../src/features/analytics/videos/videoLibrary.js';
const videos = [
{ videoId: 'a', title: 'Banana bread', channelId: 'c1', viewCount: 500, likeCount: 10, commentCount: 1, tags: ['baking'] },
diff --git a/frontend/src/features/publishing/publishHelpers.test.js b/frontend/tests/features/publishing/publishHelpers.test.js
similarity index 99%
rename from frontend/src/features/publishing/publishHelpers.test.js
rename to frontend/tests/features/publishing/publishHelpers.test.js
index 42abf04..250a2cb 100644
--- a/frontend/src/features/publishing/publishHelpers.test.js
+++ b/frontend/tests/features/publishing/publishHelpers.test.js
@@ -3,7 +3,7 @@ import assert from 'node:assert/strict';
import {
parseUserTags, parseCollaborators, buildScheduledPostPayload, buildContainerPayload, bulkPostDetails,
singleUploadMessage, singlePostError, bulkStartError, bulkBaseTime, editPostError, bulkScheduledTime,
-} from './publishHelpers.js';
+} from '../../../src/features/publishing/publishHelpers.js';
const scheduledAt = new Date('2030-05-01T08:00:00Z');
const fullPost = {
diff --git a/frontend/src/features/publishing/queueHelpers.test.js b/frontend/tests/features/publishing/queueHelpers.test.js
similarity index 97%
rename from frontend/src/features/publishing/queueHelpers.test.js
rename to frontend/tests/features/publishing/queueHelpers.test.js
index 7b07679..ea139a9 100644
--- a/frontend/src/features/publishing/queueHelpers.test.js
+++ b/frontend/tests/features/publishing/queueHelpers.test.js
@@ -3,7 +3,7 @@ import assert from 'node:assert/strict';
import {
intervalLabel, bulkStatsOf, bulkFilesTitle, bulkActionLabel, progressHeading, fileSizeMb, isVideoFile,
patchQueueItem, applyCaptionToPending, removeQueueItem,
-} from './queueHelpers.js';
+} from '../../../src/features/publishing/queueHelpers.js';
test('intervals read in days from a day upward and in hours below', () => {
assert.equal(intervalLabel(720), '12 hours');
diff --git a/frontend/src/features/publishing/scheduleHelpers.test.js b/frontend/tests/features/publishing/scheduleHelpers.test.js
similarity index 98%
rename from frontend/src/features/publishing/scheduleHelpers.test.js
rename to frontend/tests/features/publishing/scheduleHelpers.test.js
index f531a2c..7130cd2 100644
--- a/frontend/src/features/publishing/scheduleHelpers.test.js
+++ b/frontend/tests/features/publishing/scheduleHelpers.test.js
@@ -3,7 +3,7 @@ import assert from 'node:assert/strict';
import {
OVERDUE_MS, scheduledStatusChips, filterScheduledPosts, overduePostsOf, isPastDue, overdueLead, deleteAllMessage,
formatScheduleDate, toLocalDateInput, toLocalTimeInput, utcDateInput, defaultBulkStartDate, goesLiveLabel,
-} from './scheduleHelpers.js';
+} from '../../../src/features/publishing/scheduleHelpers.js';
const posts = [
{ id: 1, status: 'pending', scheduledAt: '2030-05-01T08:00:00Z' },
diff --git a/frontend/src/features/settings/schedulingProgress.test.js b/frontend/tests/features/settings/schedulingProgress.test.js
similarity index 96%
rename from frontend/src/features/settings/schedulingProgress.test.js
rename to frontend/tests/features/settings/schedulingProgress.test.js
index 43e82af..495b99c 100644
--- a/frontend/src/features/settings/schedulingProgress.test.js
+++ b/frontend/tests/features/settings/schedulingProgress.test.js
@@ -1,6 +1,6 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
-import { PROGRESS_KEY, readProgress, saveProgress, completedSteps, repoBaseUrl } from './schedulingProgress.js';
+import { PROGRESS_KEY, readProgress, saveProgress, completedSteps, repoBaseUrl } from '../../../src/features/settings/schedulingProgress.js';
function fakeStorage(initial = {}) {
const items = { ...initial };
diff --git a/frontend/src/features/settings/settingsData.test.js b/frontend/tests/features/settings/settingsData.test.js
similarity index 98%
rename from frontend/src/features/settings/settingsData.test.js
rename to frontend/tests/features/settings/settingsData.test.js
index f7b5cfd..1bec7d1 100644
--- a/frontend/src/features/settings/settingsData.test.js
+++ b/frontend/tests/features/settings/settingsData.test.js
@@ -2,7 +2,7 @@ import { test } from 'node:test';
import assert from 'node:assert/strict';
import {
loadServerSettings, githubSettingsPayload, healthCheckResult, healthCheckFailure,
-} from './settingsData.js';
+} from '../../../src/features/settings/settingsData.js';
function fakeApi({ keys = [], github }) {
const calls = [];
diff --git a/frontend/src/lib/accounts.test.js b/frontend/tests/lib/accounts.test.js
similarity index 96%
rename from frontend/src/lib/accounts.test.js
rename to frontend/tests/lib/accounts.test.js
index 5d3f053..45bcc2c 100644
--- a/frontend/src/lib/accounts.test.js
+++ b/frontend/tests/lib/accounts.test.js
@@ -1,6 +1,6 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
-import { platformOf, accountPath, accountName, accountHandle, accountInitials, audienceOf, platformSummary } from './accounts.js';
+import { platformOf, accountPath, accountName, accountHandle, accountInitials, audienceOf, platformSummary } from '../../src/lib/accounts.js';
const youtubeAccount = { id: 'y1', title: 'Studio Dusk', customUrl: '@studiodusk', subscriberCount: 1200 };
const instagramAccount = { id: 'i1', platform: 'instagram', title: 'Paper Fold', username: 'paperfold', followersCount: 800 };
diff --git a/frontend/src/lib/commandSearch.test.js b/frontend/tests/lib/commandSearch.test.js
similarity index 95%
rename from frontend/src/lib/commandSearch.test.js
rename to frontend/tests/lib/commandSearch.test.js
index 2200771..b16c1ad 100644
--- a/frontend/src/lib/commandSearch.test.js
+++ b/frontend/tests/lib/commandSearch.test.js
@@ -1,6 +1,6 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
-import { scoreCommand, filterCommands, groupCommands } from './commandSearch.js';
+import { scoreCommand, filterCommands, groupCommands } from '../../src/lib/commandSearch.js';
const commands = [
{ id: 'overview', group: 'Pages', label: 'Overview', keywords: ['Analytics'] },
diff --git a/frontend/src/lib/googleIdentity.test.js b/frontend/tests/lib/googleIdentity.test.js
similarity index 89%
rename from frontend/src/lib/googleIdentity.test.js
rename to frontend/tests/lib/googleIdentity.test.js
index c68c5fa..a58adad 100644
--- a/frontend/src/lib/googleIdentity.test.js
+++ b/frontend/tests/lib/googleIdentity.test.js
@@ -1,6 +1,6 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
-import { createNonce, sha256Hex } from './googleIdentity.js';
+import { createNonce, sha256Hex } from '../../src/lib/googleIdentity.js';
test('sha256Hex matches the known digest', async () => {
assert.equal(await sha256Hex('abc'), 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad');
diff --git a/frontend/src/lib/holdProgress.test.js b/frontend/tests/lib/holdProgress.test.js
similarity index 97%
rename from frontend/src/lib/holdProgress.test.js
rename to frontend/tests/lib/holdProgress.test.js
index 85ef42e..a1c7412 100644
--- a/frontend/src/lib/holdProgress.test.js
+++ b/frontend/tests/lib/holdProgress.test.js
@@ -1,6 +1,6 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
-import { createHoldController } from './holdProgress.js';
+import { createHoldController } from '../../src/lib/holdProgress.js';
// A manual clock and frame queue so timing can be stepped deterministically
function harness(duration = 1000) {
diff --git a/frontend/src/lib/icons.test.js b/frontend/tests/lib/icons.test.js
similarity index 93%
rename from frontend/src/lib/icons.test.js
rename to frontend/tests/lib/icons.test.js
index 3861714..4fc0bc7 100644
--- a/frontend/src/lib/icons.test.js
+++ b/frontend/tests/lib/icons.test.js
@@ -5,7 +5,7 @@ import { join, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import * as lucide from 'lucide-react';
-const SRC = join(dirname(fileURLToPath(import.meta.url)), '..');
+const SRC = join(dirname(fileURLToPath(import.meta.url)), '..', '..', 'src');
function sourceFiles(dir) {
return readdirSync(dir).flatMap(name => {
diff --git a/frontend/src/lib/library.test.js b/frontend/tests/lib/library.test.js
similarity index 96%
rename from frontend/src/lib/library.test.js
rename to frontend/tests/lib/library.test.js
index 996713a..ccfd990 100644
--- a/frontend/src/lib/library.test.js
+++ b/frontend/tests/lib/library.test.js
@@ -1,6 +1,6 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
-import { parseIsoDuration, engagementPercent, filterByTier, VIEW_TIERS, LIKE_TIERS, pageSlice, matchesText } from './library.js';
+import { parseIsoDuration, engagementPercent, filterByTier, VIEW_TIERS, LIKE_TIERS, pageSlice, matchesText } from '../../src/lib/library.js';
test('ISO 8601 durations convert to seconds', () => {
assert.equal(parseIsoDuration('PT1H2M3S'), 3723);
diff --git a/frontend/src/utils/instagramContent.test.js b/frontend/tests/utils/instagramContent.test.js
similarity index 90%
rename from frontend/src/utils/instagramContent.test.js
rename to frontend/tests/utils/instagramContent.test.js
index 1bddd8a..817e4b7 100644
--- a/frontend/src/utils/instagramContent.test.js
+++ b/frontend/tests/utils/instagramContent.test.js
@@ -1,6 +1,6 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
-import { igThumbnail } from './instagramContent.js';
+import { igThumbnail } from '../../src/utils/instagramContent.js';
test('image posts fall back to the media url', () => {
assert.equal(igThumbnail({ contentType: 'post', mediaUrl: 'image.jpg' }), 'image.jpg');