File tree Expand file tree Collapse file tree 3 files changed +36
-4
lines changed Expand file tree Collapse file tree 3 files changed +36
-4
lines changed Original file line number Diff line number Diff line change
1
+ import { SupabaseAuthClient } from '../src/lib/SupabaseAuthClient'
2
+
3
+ const DEFAULT_OPTIONS = {
4
+ schema : 'public' ,
5
+ autoRefreshToken : true ,
6
+ persistSession : true ,
7
+ detectSessionInUrl : true ,
8
+ headers : { } ,
9
+ }
10
+ const settings = { ...DEFAULT_OPTIONS }
11
+
12
+ test ( 'it should create a new instance of the class' , ( ) => {
13
+ const authClient = new SupabaseAuthClient ( settings )
14
+ expect ( authClient ) . toBeInstanceOf ( SupabaseAuthClient )
15
+ } )
Original file line number Diff line number Diff line change 1
- import { createClient } from '../src/index'
1
+ import { createClient , SupabaseClient } from '../src/index'
2
2
3
3
const URL = 'http://localhost:3000'
4
4
const KEY = 'some.fake.key'
5
5
6
6
const supabase = createClient ( URL , KEY )
7
7
8
- test ( 'Build to succeed' , async ( ) => {
9
- // Basic test to ensure TS build is working.
10
- expect ( true ) . toEqual ( true )
8
+ test ( 'it should create the client connection' , async ( ) => {
9
+ expect ( supabase ) . toBeDefined ( )
10
+ expect ( supabase ) . toBeInstanceOf ( SupabaseClient )
11
+ } )
12
+
13
+ test ( 'it should throw an error if no valid params are provided' , async ( ) => {
14
+ expect ( ( ) => createClient ( '' , KEY ) ) . toThrowError ( 'supabaseUrl is required.' )
15
+ expect ( ( ) => createClient ( URL , '' ) ) . toThrowError ( 'supabaseKey is required.' )
11
16
} )
12
17
13
18
// Socket should close when there are no open connections
Original file line number Diff line number Diff line change
1
+ import { DEFAULT_HEADERS } from '../src/lib/constants'
2
+ import { version } from '../src/lib/version'
3
+
4
+ test ( 'it has the correct type of returning with the correct value' , ( ) => {
5
+ const expected = {
6
+ 'X-Client-Info' : `supabase-js/${ version } ` ,
7
+ }
8
+ expect ( DEFAULT_HEADERS ) . toEqual ( expected )
9
+ expect ( typeof DEFAULT_HEADERS ) . toBe ( 'object' )
10
+ expect ( typeof DEFAULT_HEADERS [ 'X-Client-Info' ] ) . toBe ( 'string' )
11
+ expect ( Object . keys ( DEFAULT_HEADERS ) . length ) . toBe ( 1 )
12
+ } )
You can’t perform that action at this time.
0 commit comments