22 lines
815 B
TypeScript
22 lines
815 B
TypeScript
import { createBrowserClient, Constants, type PlatformRole } from '../src'
|
|
|
|
describe('createBrowserClient', () => {
|
|
it('builds a typed client bound to the given project URL', () => {
|
|
const client = createBrowserClient({
|
|
url: 'http://127.0.0.1:54321',
|
|
anonKey: 'anon-key-placeholder',
|
|
})
|
|
expect(typeof client.from).toBe('function')
|
|
expect(client.auth).toBeDefined()
|
|
// supabase-js keeps the resolved REST URL on the client instance.
|
|
expect(
|
|
String((client as unknown as { supabaseUrl: string }).supabaseUrl),
|
|
).toContain('127.0.0.1:54321')
|
|
})
|
|
|
|
it('exposes the platform roles as runtime constants', () => {
|
|
const roles: readonly PlatformRole[] = Constants.public.Enums.platform_role
|
|
expect(roles).toEqual(['owner', 'admin', 'moderator', 'support'])
|
|
})
|
|
})
|