@@ -16,31 +16,32 @@ describe("Smoke tests", () => {
1616
1717 it ( "userAgent option" , ( ) => {
1818 const mock = fetchMock
19- . sandbox ( )
20- . getOnce ( "https://api.github.com/" , ( _url , { headers } ) => {
21- // @ts -ignore headers has wrong typing in fetch-mock 8.3.2
22- expect ( headers [ "user-agent" ] ) . toMatch ( / ^ m y - a p p \/ 1 .2 .3 / ) ;
19+ . createInstance ( )
20+ . getOnce ( "https://api.github.com/" , ( _url ) => {
21+ expect (
22+ mock . callHistory . calls ( ) [ 0 ] . options . headers ! [ "user-agent" ] ,
23+ ) . toMatch ( / ^ m y - a p p \/ 1 .2 .3 / ) ;
2324
2425 return { ok : true } ;
2526 } ) ;
2627
2728 const octokit = new Octokit ( {
2829 userAgent : "my-app/1.2.3" ,
2930 request : {
30- fetch : mock ,
31+ fetch : mock . fetchHandler ,
3132 } ,
3233 } ) ;
3334 return octokit . request ( "/" ) ;
3435 } ) ;
3536
3637 it ( "@octokit/plugin-rest-endpoint-methods" , ( ) => {
3738 const mock = fetchMock
38- . sandbox ( )
39+ . createInstance ( )
3940 . getOnce ( "path:/repos/octocat/hello-world" , { ok : true } ) ;
4041
4142 const octokit = new Octokit ( {
4243 request : {
43- fetch : mock ,
44+ fetch : mock . fetchHandler ,
4445 } ,
4546 } ) ;
4647
@@ -58,7 +59,7 @@ describe("Smoke tests", () => {
5859
5960 it ( "@octokit/plugin-request-log" , ( ) => {
6061 const mock = fetchMock
61- . sandbox ( )
62+ . createInstance ( )
6263 . getOnce ( "path:/" , { status : 200 , body : { } } )
6364 . getOnce ( "path:/" , { status : 404 , body : { } } , { overwriteRoutes : false } ) ;
6465
@@ -72,7 +73,7 @@ describe("Smoke tests", () => {
7273 const octokit = new Octokit ( {
7374 log : consoleStub ,
7475 request : {
75- fetch : mock ,
76+ fetch : mock . fetchHandler ,
7677 } ,
7778 } ) ;
7879
0 commit comments