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 11// constants.ts
22import { 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'
22import { version } from '../src/lib/version'
33
44test ( '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+ }
516 const expected = {
6- 'X-Client-Info' : `supabase-js/${ version } ` ,
17+ 'X-Client-Info' : `supabase-js- ${ JS_ENV } /${ version } ` ,
718 }
819 expect ( DEFAULT_HEADERS ) . toEqual ( expected )
920 expect ( typeof DEFAULT_HEADERS ) . toBe ( 'object' )
You can’t perform that action at this time.
0 commit comments