File tree Expand file tree Collapse file tree 3 files changed +3
-27
lines changed Expand file tree Collapse file tree 3 files changed +3
-27
lines changed Original file line number Diff line number Diff line change @@ -136,38 +136,16 @@ describe('Additional Coverage Tests', () => {
136136 params : { apikey : '123456789' } ,
137137 } )
138138
139- // Access the _resolveFetch method to test Node.js fallback
139+ // Access the _resolveFetch method to test native fetch usage
140140 const fetchFn = socket . _resolveFetch ( )
141141
142- // Test that it returns a function that would import node- fetch
142+ // Test that it returns a function (should use native fetch)
143143 expect ( typeof fetchFn ) . toBe ( 'function' )
144144
145145 // Restore fetch
146146 global . fetch = originalFetch
147147 } )
148148
149- test ( 'should handle node-fetch import failure' , async ( ) => {
150- // Mock environment without fetch
151- const originalFetch = global . fetch
152- // @ts -ignore
153- delete global . fetch
154-
155- const socket = new RealtimeClient ( testSetup . url , {
156- params : { apikey : '123456789' } ,
157- } )
158-
159- const fetchFn = socket . _resolveFetch ( )
160-
161- // Try to call the fetch function (it should attempt to import node-fetch and fail)
162- try {
163- await fetchFn ( 'http://example.com' )
164- } catch ( error ) {
165- expect ( error . message ) . toContain ( 'Failed to load @supabase/node-fetch' )
166- }
167-
168- // Restore fetch
169- global . fetch = originalFetch
170- } )
171149 } )
172150
173151 describe ( '_leaveOpenTopic' , ( ) => {
Original file line number Diff line number Diff line change @@ -26,7 +26,6 @@ const versions = {
2626 postgrest : getVersion ( '@supabase/postgrest-js' ) ,
2727 auth : getVersion ( '@supabase/auth-js' ) ,
2828 storage : getVersion ( '@supabase/storage-js' ) ,
29- node_fetch : getVersion ( '@supabase/node-fetch' ) ,
3029}
3130
3231// Read or create deno.json
@@ -54,7 +53,6 @@ denoJson.imports = {
5453 process . env . STORAGE_JS_ENTRY === 'main'
5554 ? `npm:@supabase/storage-js@${ versions . storage } /dist/main/index.js`
5655 : `npm:@supabase/storage-js@${ versions . storage } /dist/module/index.js` ,
57- '@supabase/node-fetch' : `npm:@supabase/node-fetch@${ versions . node_fetch } ` ,
5856}
5957
6058// Ensure Node types are available for Deno type-checking of .d.ts files
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ describe('fetch module', () => {
3333 expect ( globalFetch ) . toHaveBeenCalledWith ( 'test' )
3434 } )
3535
36- test ( 'should fallback to node- fetch when global fetch is undefined ' , ( ) => {
36+ test ( 'should return native fetch when no custom fetch provided ' , ( ) => {
3737 const result = resolveFetch ( )
3838 expect ( typeof result ) . toBe ( 'function' )
3939 } )
You can’t perform that action at this time.
0 commit comments