Skip to content

test(editor): add warn to logger mock so suite runs without Supabase env - #8

Merged
MeepCastana merged 1 commit into
developfrom
fix/editor-test-logger-mock
Aug 6, 2026
Merged

MeepCastana merged 1 commit into
developfrom
fix/editor-test-logger-mock

Conversation

@OGtwelve

@OGtwelve OGtwelve commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

What

On a fresh checkout without VITE_SUPABASE_URL / VITE_SUPABASE_PUBLISHABLE_KEY, npm run test:run fails before running a single test in editor.test.tsx:

FAIL src/features/editor/components/editor.test.tsx
TypeError: logger.warn is not a function
 ❯ src/infrastructure/supabase/client.ts:32:10

client.ts calls logger.warn at import time when Supabase env is missing, but the suite's createLogger mock only provided debug/error/info. On machines with the env configured the warn path never runs, which is why this only shows up on unconfigured checkouts.

How

Add warn: vi.fn() to the mock — one line.

Verification

bunx vitest run src/features/editor/components/editor.test.tsx with no Supabase env: suite passes (2 tests). Full test:run is green with this applied: 211 files, 1259 tests.

The mocked createLogger returned only debug/error/info. On checkouts
without VITE_SUPABASE_* set, src/infrastructure/supabase/client.ts calls
logger.warn at import time, so the whole editor.test.tsx suite died with
'logger.warn is not a function' before running a single test.

@MeepCastana MeepCastana left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed locally on a combined review branch (all six merged clean, no conflicts). CI green. Approved.

@MeepCastana
MeepCastana merged commit a60fa43 into develop Aug 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants