Skip to content

test(env): add unit tests for loadEmailJSConfig, loadSupabaseConfig, loadAdminConfig and loadStellarConfig (closes #94) - #303

Open
Ranjeet2063 wants to merge 1 commit into
Movalabs-crew:mainfrom
Ranjeet2063:test/env-config-loaders-unit-tests
Open

Ranjeet2063 wants to merge 1 commit into
Movalabs-crew:mainfrom
Ranjeet2063:test/env-config-loaders-unit-tests

Conversation

@Ranjeet2063

Copy link
Copy Markdown
Contributor

Summary of Changes

Resolves issue #94 by adding comprehensive unit tests for the environment configuration loaders in lib/env.ts (loadEmailJSConfig, loadSupabaseConfig, loadAdminConfig, and loadStellarConfig).

Key Changes

  • Extended tests/lib/env.test.ts with tests verifying:
    1. loadEmailJSConfig:
      • Loads valid serviceId, templateId, publicKey, and defaultRecipientEmail.
      • Pushes descriptive validation errors when required variables are unset.
      • Treats whitespace-only values as missing and trims non-empty values.
    2. loadSupabaseConfig:
      • Loads valid url and anonKey.
      • Pushes validation errors when required variables are missing or whitespace-only.
    3. loadAdminConfig:
      • Trims and lowercases comma-separated email addresses, ignoring empty entries.
      • Returns [] for empty string, whitespace, or comma-only values.
    4. loadStellarConfig:
      • Loads network and rpcUrl defaults and requires NEXT_PUBLIC_CHECKOUT_CONTRACT_ID.
      • Validates missing or whitespace checkout contract id.

Verification (2x Verified)

  • npx vitest run tests/lib/env.test.ts (21/21 tests pass)
  • npm run type-check (0 errors)
  • npm run lint (0 errors)
  • npx prettier --check (100% formatted)

Closes #94

Copilot AI lite review requested due to automatic review settings September 4, 2026 21:46
@vercel

vercel Bot commented Sep 4, 2026

Copy link
Copy Markdown

@Ranjeet2063 is attempting to deploy a commit to the Oluremi's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This branch has not been deployed

No deployments
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.

[Bounty: $95] Add unit tests for the env.ts config loaders loadEmailJSConfig, loadSupabaseConfig and loadAdminConfig

2 participants