Skip to content

test(backend): add unit coverage for deployment fixtures, env template generator, supabase lock, and server client factory - #1201

Open
tegaReed-crypto wants to merge 1 commit into
StellerCraft:mainfrom
tegaReed-crypto:feature/issue-1083-1086
Open

test(backend): add unit coverage for deployment fixtures, env template generator, supabase lock, and server client factory#1201
tegaReed-crypto wants to merge 1 commit into
StellerCraft:mainfrom
tegaReed-crypto:feature/issue-1083-1086

Conversation

@tegaReed-crypto

Copy link
Copy Markdown

Summary

Adds co-located unit test suites for four backend utilities that previously had no dedicated test coverage:

  • apps/backend/src/lib/deployment-fixtures.test.ts
  • apps/backend/src/lib/env/env-template-generator.test.ts
  • apps/backend/src/lib/supabase/supabase-lock.test.ts
  • apps/backend/src/lib/supabase/server.test.ts

Changes

deployment-fixtures.test.ts

  • Verifies MOCK_DEPLOYMENTS array shape and required fields.
  • Confirms valid environments, triggers, and date formatting.
  • Asserts MOCK_ANALYTICS has sensible defaults.

env-template-generator.test.ts

  • Covers target scoping for all supported Vercel targets (production/preview/development).
  • Validates secret vs plain variable classification.
  • Tests family-specific overrides and config-driven entry generation.

supabase-lock.test.ts

  • Mocks the Supabase client RPC layer.
  • Verifies hashKey determinism and distinct-key non-collision.
  • Covers immediate lock acquisition, polling success, timeout returning false, and RPC error throwing.

server.test.ts

  • Mocks next/headers and @supabase/ssr.
  • Asserts client creation reads from expected environment variables.
  • Confirms missing required env vars throws clear errors.

Test Plan

Run the targeted backend test suites:

npm run test --workspace=@craft/backend -- deployment-fixtures
npm run test --workspace=@craft/backend -- env-template-generator
npm run test --workspace=@craft/backend -- supabase-lock
npm run test --workspace=@craft/backend -- lib/supabase/server

Issues Closed

Closes #1083
Closes #1084
Closes #1085
Closes #1086

…e generator, supabase lock, and server client factory

- deployment-fixtures.test.ts: cover shape correctness, valid environments/triggers, and analytics defaults
- env-template-generator.test.ts: cover target scoping, secret/plain classification, and family-specific overrides
- supabase-lock.test.ts: cover hashKey determinism, polling success, timeout, and RPC error paths
- server.test.ts: cover env-var-driven client creation and missing-config error handling

Closes StellerCraft#1083
Closes StellerCraft#1084
Closes StellerCraft#1085
Closes StellerCraft#1086

Co-authored-by: Kilo <[email protected]>
@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

@tegaReed-crypto Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant