11import { expect } from "chai" ;
22import { describe , test } from "mocha" ;
33import { fake } from 'sinon' ;
4- import { WjFetch } from "../WjFetch .js" ;
4+ import { DrFetch } from "../DrFetch .js" ;
55
6- describe ( 'WjFetch ' , ( ) => {
6+ describe ( 'DrFetch ' , ( ) => {
77 describe ( 'clone()' , ( ) => {
88 [
99 {
@@ -32,7 +32,7 @@ describe('WjFetch', () => {
3232 const contentType = 'text/plain' ;
3333 const origFetchFn = fake . resolves ( new Response ( 'Hi!' , { headers : { 'content-type' : contentType } } ) ) ;
3434 const customParserFn = fake ( ) ;
35- const origFetcher = new WjFetch ( origFetchFn ) ;
35+ const origFetcher = new DrFetch ( origFetchFn ) ;
3636 origFetcher . withParser ( contentType , customParserFn ) ;
3737 const newFetchFn = fake . resolves ( new Response ( 'Hi!' , { headers : { 'content-type' : contentType } } ) ) ;
3838
@@ -52,7 +52,7 @@ describe('WjFetch', () => {
5252 const origFetch = globalThis . fetch ;
5353 const fakeFetch = fake . resolves ( new Response ( null ) ) ;
5454 globalThis . fetch = fakeFetch ;
55- const fetcher = new WjFetch ( ) ;
55+ const fetcher = new DrFetch ( ) ;
5656
5757 // Act.
5858 try {
@@ -68,7 +68,7 @@ describe('WjFetch', () => {
6868 test ( "Should call the provided data-fetching function." , async ( ) => {
6969 // Arrange.
7070 const fakeFetch = fake . resolves ( new Response ( null ) ) ;
71- const fetcher = new WjFetch ( fakeFetch ) ;
71+ const fetcher = new DrFetch ( fakeFetch ) ;
7272
7373 // Act.
7474 await fetcher . fetch ( 'x' ) ;
@@ -116,7 +116,7 @@ describe('WjFetch', () => {
116116 test ( `Should parse the body using the stock body parsers when content type is "${ tc . contentType } ".` , async ( ) => {
117117 // Arrange.
118118 const fetchFn = fake . resolves ( new Response ( tc . body , { headers : { 'content-type' : tc . contentType } } ) ) ;
119- const fetcher = new WjFetch ( fetchFn ) ;
119+ const fetcher = new DrFetch ( fetchFn ) ;
120120
121121 // Act.
122122 const result = await fetcher . for < 200 , string | object > ( ) . fetch ( 'x' ) ;
@@ -133,7 +133,7 @@ describe('WjFetch', () => {
133133 test ( "Should return 'null' as body whenever the response carries no body." , async ( ) => {
134134 // Arrange.
135135 const fetchFn = fake . resolves ( new Response ( ) ) ;
136- const fetcher = new WjFetch ( fetchFn ) ;
136+ const fetcher = new DrFetch ( fetchFn ) ;
137137
138138 // Act.
139139 const response = await fetcher . for < 200 , string > ( ) . fetch ( 'x' ) ;
@@ -146,7 +146,7 @@ describe('WjFetch', () => {
146146 const response = new Response ( 'x' ) ;
147147 response . headers . delete ( 'content-type' ) ;
148148 const fetchFn = fake . resolves ( response ) ;
149- const fetcher = new WjFetch ( fetchFn ) ;
149+ const fetcher = new DrFetch ( fetchFn ) ;
150150 let didThrow = false ;
151151
152152 // Act.
@@ -163,7 +163,7 @@ describe('WjFetch', () => {
163163 test ( "Should throw an error if the content type is unknown by the built-in parsers and custom parsers." , async ( ) => {
164164 // Arrange.
165165 const fetchFn = fake . resolves ( new Response ( 'x' , { headers : { 'content-type' : 'application/xml' } } ) ) ;
166- const fetcher = new WjFetch ( fetchFn ) ;
166+ const fetcher = new DrFetch ( fetchFn ) ;
167167 let didThrow = false ;
168168
169169 // Act.
@@ -200,7 +200,7 @@ describe('WjFetch', () => {
200200 ] ,
201201 } ,
202202 ] . flatMap ( x => {
203- const expanded = [ ] ;
203+ const expanded : ( Omit < ( typeof x ) , 'contentTypes' > & { contentType : string ; } ) [ ] = [ ] ;
204204 for ( let ct of x . contentTypes ) {
205205 expanded . push ( {
206206 pattern : x . pattern ,
@@ -214,7 +214,7 @@ describe('WjFetch', () => {
214214 // Arrange.
215215 const parserFn = fake ( ) ;
216216 const fetchFn = fake . resolves ( new Response ( 'x' , { headers : { 'content-type' : tc . contentType } } ) ) ;
217- const fetcher = new WjFetch ( fetchFn ) ;
217+ const fetcher = new DrFetch ( fetchFn ) ;
218218 fetcher . withParser ( tc . pattern , parserFn ) ;
219219
220220 // Act.
0 commit comments