File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 1
1
// constants.ts
2
2
import { version } from './version'
3
- export const DEFAULT_HEADERS = { 'X-Client-Info' : `supabase-js/${ version } ` }
3
+ let JS_ENV = ''
4
+ // @ts -ignore
5
+ if ( typeof Deno !== 'undefined' ) {
6
+ JS_ENV = 'deno'
7
+ } else if ( typeof document !== 'undefined' ) {
8
+ JS_ENV = 'web'
9
+ } else if ( typeof navigator !== 'undefined' && navigator . product === 'ReactNative' ) {
10
+ JS_ENV = 'react-native'
11
+ } else {
12
+ JS_ENV = 'node'
13
+ }
14
+ export const DEFAULT_HEADERS = { 'X-Client-Info' : `supabase-js-${ JS_ENV } /${ version } ` }
Original file line number Diff line number Diff line change @@ -2,8 +2,19 @@ import { DEFAULT_HEADERS } from '../src/lib/constants'
2
2
import { version } from '../src/lib/version'
3
3
4
4
test ( 'it has the correct type of returning with the correct value' , ( ) => {
5
+ let JS_ENV = ''
6
+ // @ts -ignore
7
+ if ( typeof Deno !== 'undefined' ) {
8
+ JS_ENV = 'deno'
9
+ } else if ( typeof document !== 'undefined' ) {
10
+ JS_ENV = 'web'
11
+ } else if ( typeof navigator !== 'undefined' && navigator . product === 'ReactNative' ) {
12
+ JS_ENV = 'react-native'
13
+ } else {
14
+ JS_ENV = 'node'
15
+ }
5
16
const expected = {
6
- 'X-Client-Info' : `supabase-js/${ version } ` ,
17
+ 'X-Client-Info' : `supabase-js- ${ JS_ENV } /${ version } ` ,
7
18
}
8
19
expect ( DEFAULT_HEADERS ) . toEqual ( expected )
9
20
expect ( typeof DEFAULT_HEADERS ) . toBe ( 'object' )
You can’t perform that action at this time.
0 commit comments