@@ -3,24 +3,29 @@ import { useTestConfig } from "./useTestConfig.ts";
33import useFetch from "./useFetch.ts"
44
55
6- Deno . test ( "fetch user-agent header check" , async ( ) => {
7- const UserAgent = "tests/1.2.3"
8- useTestConfig ( { UserAgent } )
6+ Deno . test ( {
7+ name : "fetch user-agent header check" ,
8+ /// doesn't work inside DNT because fetch is shimmed to undici
9+ ignore : ! ! Deno . env . get ( "NODE" ) ,
10+ async fn ( ) {
11+ const UserAgent = "tests/1.2.3"
12+ useTestConfig ( { UserAgent } )
913
10- const url = "https://example.com" ;
11- const fetchStub = stub (
12- globalThis ,
13- "fetch" ,
14- ( ) => Promise . resolve ( new Response ( "" ) ) ,
15- ) ;
14+ const url = "https://example.com" ;
15+ const fetchStub = stub (
16+ globalThis ,
17+ "fetch" ,
18+ ( ) => Promise . resolve ( new Response ( "" ) ) ,
19+ ) ;
1620
17- try {
18- await useFetch ( url , { } ) ;
19- } finally {
20- fetchStub . restore ( ) ;
21- }
21+ try {
22+ await useFetch ( url , { } ) ;
23+ } finally {
24+ fetchStub . restore ( ) ;
25+ }
2226
23- assertSpyCallArgs ( fetchStub , 0 , [ url , {
24- headers : { "User-Agent" : UserAgent }
25- } ] ) ;
27+ assertSpyCallArgs ( fetchStub , 0 , [ url , {
28+ headers : { "User-Agent" : UserAgent }
29+ } ] ) ;
30+ }
2631} ) ;
0 commit comments