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') }) })