Files
Dungeons-Ground/apps/web/server/utils/runtime-config.test.ts
pavel444-byte 438e5af0ad
Some checks failed
CI / validate (push) Failing after 9m21s
Important Fixes, New mechanics, and many more
2026-08-15 17:37:57 +05:00

21 lines
977 B
TypeScript

import { describe, expect, it } from 'vitest'
import { assertRequiredSupabaseConfig } from './runtime-config'
describe('required Supabase runtime config', () => {
it('accepts complete credentials', () => {
expect(() => assertRequiredSupabaseConfig({ supabaseUrl: 'https://example.supabase.co', supabaseServiceRoleKey: 'service', public: { supabaseUrl: 'https://example.supabase.co', supabaseAnonKey: 'anon' } })).not.toThrow()
})
it('reports missing credentials clearly', () => {
expect(() => assertRequiredSupabaseConfig({ public: {} })).toThrow('SUPABASE_SERVICE_ROLE_KEY is required')
})
it('rejects credentials from different Supabase projects', () => {
expect(() => assertRequiredSupabaseConfig({
supabaseUrl: 'https://server-project.supabase.co',
supabaseServiceRoleKey: 'service',
public: { supabaseUrl: 'https://public-project.supabase.co', supabaseAnonKey: 'anon' },
})).toThrow('must point to the same project')
})
})