Skip to content

Commit 3faccce

Browse files
Programcodeclaude
andcommitted
chore: remove dead code and tautological tests
Dead code (zero references anywhere, including tests): - src/lib/ai/prompts/index.ts (165 lines) — prompt building moved server-side to supabase/functions/_shared/prompts.ts - useKeyboardShortcuts, useResolvedTheme hooks - isUrlSafe (validateUrl is the live entry point) - requireAdmin in _shared/auth.ts — admin/index.ts does its own inline user_roles lookups - getAppRedirectUrl in native.ts - mockSparringResponse/mockSparringScore aliases - buildSearchQueries wrapper — inlined the one-line .map into its two callers, which were both tests Tests that assert nothing about our code: - example.test.ts: expect(true).toBe(true) - utils.test.ts: 11 tests over cn(), a one-line clsx+tailwind-merge pass-through — tested the libraries, not us - providers.test.ts: 14 of 15 tests re-asserted that a static const is still a static const; kept the duplicate-model-ID check, which guards real routing behavior - i18n.test.ts: "locale has keys" tautologies and a key-count check subsumed by the bidirectional key-set comparisons - export-utils-extended.test.ts: 6 "typeof x === function" tests - pages/HistoryPage smoke tests asserting document.body is defined - settings-store-branches: the `afterRehydrate(undefined)` call existed only to hit an `if (!state) return` line Preserved deliberately: setActiveEnv/IS_STAGING in supabase/env.ts (reserved by plans/supabase-staging.md for the admin env switcher), and security-hardening/runtime-contracts/vercel-deployment-config tests, which guard invariants from PRs #26/#27. Verified: 921 tests pass, lint clean, tsc clean, build succeeds, coverage thresholds still met (statements 90.45/90, branches 82.91/80, functions 91.46/89, lines 94.04/90). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 79b65ca commit 3faccce

18 files changed

Lines changed: 8 additions & 533 deletions

‎src/hooks/use-keyboard-shortcuts.ts‎

Lines changed: 0 additions & 26 deletions
This file was deleted.

‎src/hooks/use-resolved-theme.ts‎

Lines changed: 0 additions & 35 deletions
This file was deleted.

‎src/lib/ai/prompts/index.ts‎

Lines changed: 0 additions & 165 deletions
This file was deleted.

‎src/lib/ai/providers/mock-provider.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,5 +508,3 @@ export async function mockJudgeSparringSession(input: SparringScoreInput): Promi
508508
}
509509

510510
// Names kept short for callers that treat the mock provider as a feature adapter.
511-
export const mockSparringResponse = mockGenerateSparringTurn;
512-
export const mockSparringScore = mockJudgeSparringSession;

‎src/lib/native.ts‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ export function isNativeApp(): boolean {
99
return Capacitor.isNativePlatform();
1010
}
1111

12-
export function getAppRedirectUrl(path = '/app'): string {
13-
if (isNativeApp()) return `${NATIVE_URL_SCHEME}://${path.replace(/^\/+/, '')}`;
14-
return `${window.location.origin}${path}`;
15-
}
16-
1712
export function getWebAppRedirectUrl(path = '/app'): string {
1813
const origin = isNativeApp() ? PUBLIC_WEB_APP_ORIGIN : window.location.origin;
1914
return `${origin}${path}`;

‎src/lib/validation/url.ts‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,3 @@ export function validateUrl(url?: string): string | undefined {
5555
return undefined;
5656
}
5757
}
58-
59-
/**
60-
* Checks if a URL is safe without normalizing it.
61-
* Useful for validation-only scenarios.
62-
*/
63-
export function isUrlSafe(url?: string): boolean {
64-
return validateUrl(url) !== undefined;
65-
}

‎src/test/example.test.ts‎

Lines changed: 0 additions & 7 deletions
This file was deleted.

‎src/test/export-utils-extended.test.ts‎

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -225,29 +225,4 @@ describe('Export Utils - Extended', () => {
225225
});
226226
});
227227

228-
describe('PDF export functions exist', () => {
229-
it('exportCaseToDocx is a function', () => {
230-
expect(typeof exportCaseToDocx).toBe('function');
231-
});
232-
233-
it('exportAttackToDocx is a function', () => {
234-
expect(typeof exportAttackToDocx).toBe('function');
235-
});
236-
237-
it('exportBrainstormToDocx is a function', () => {
238-
expect(typeof exportBrainstormToDocx).toBe('function');
239-
});
240-
241-
it('exportFactoidsToDocx is a function', () => {
242-
expect(typeof exportFactoidsToDocx).toBe('function');
243-
});
244-
245-
it('exportCaseToGoogleDocs is a function', () => {
246-
expect(typeof exportCaseToGoogleDocs).toBe('function');
247-
});
248-
249-
it('exportBrainstormToGoogleDocs is a function', () => {
250-
expect(typeof exportBrainstormToGoogleDocs).toBe('function');
251-
});
252-
});
253228
});

‎src/test/i18n.test.ts‎

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,6 @@ describe('i18n locale files', () => {
3232
const esKeys = flattenKeys(es);
3333
const huKeys = flattenKeys(hu);
3434

35-
it('en.json has keys', () => {
36-
expect(enKeys.length).toBeGreaterThan(0);
37-
});
38-
39-
it('es.json has keys', () => {
40-
expect(esKeys.length).toBeGreaterThan(0);
41-
});
42-
43-
it('hu.json has keys', () => {
44-
expect(huKeys.length).toBeGreaterThan(0);
45-
});
46-
47-
it('all 3 locale files have same number of keys', () => {
48-
expect(enKeys.length).toBe(esKeys.length);
49-
expect(enKeys.length).toBe(huKeys.length);
50-
});
51-
5235
it('all keys in en.json exist in es.json', () => {
5336
const esKeySet = new Set(esKeys);
5437
const missing = enKeys.filter(k => !esKeySet.has(k));
@@ -100,15 +83,9 @@ describe('i18n locale files', () => {
10083
});
10184

10285
describe('i18n runtime', () => {
103-
it('i18n.t returns correct English value for nav.home', () => {
86+
it('i18n.t resolves English nav values', () => {
10487
expect(i18n.t('nav.home')).toBe('Home');
105-
});
106-
107-
it('i18n.t returns correct English value for nav.generate', () => {
10888
expect(i18n.t('nav.generate')).toBe('Generate');
109-
});
110-
111-
it('i18n.t returns correct English value for nav.settings', () => {
11289
expect(i18n.t('nav.settings')).toBe('Settings');
11390
});
11491

@@ -124,11 +101,6 @@ describe('i18n runtime', () => {
124101
await i18n.changeLanguage('en');
125102
});
126103

127-
it('i18n.changeLanguage back to en', async () => {
128-
await i18n.changeLanguage('en');
129-
expect(i18n.language).toBe('en');
130-
});
131-
132104
it('interpolation works for limitModal.limitReachedDesc', () => {
133105
const result = i18n.t('limitModal.limitReachedDesc', { current: 5, limit: 10 });
134106
expect(result).toContain('5');

‎src/test/pages/HistoryPage.test.tsx‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,4 @@ describe('HistoryPage', () => {
114114
const { container } = render(<HistoryPage />);
115115
expect(container.querySelector('.max-w-5xl')).not.toBeNull();
116116
});
117-
118-
it('renders without crashing with empty arrays', () => {
119-
const { container } = render(<HistoryPage />);
120-
expect(container).toBeDefined();
121-
});
122117
});

0 commit comments

Comments
 (0)