Skip to content

Commit

Permalink
Fix http client fallback tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig committed Aug 14, 2023
1 parent 4fddfda commit 7b17f10
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/api/test/unit/client/httpClientFallback.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe("httpClient fallback", () => {

// Using fetchSub instead of actually setting up servers because there are some strange
// race conditions, where the server stub doesn't count the call in time before the test is over.
const fetchStub = Sinon.stub<[string], ReturnType<typeof fetch>>();
const fetchStub = Sinon.stub<[URL], ReturnType<typeof fetch>>();

let httpClient: HttpClient;

Expand All @@ -21,10 +21,10 @@ describe("httpClient fallback", () => {
const serverErrors = new Map<number, boolean>();

// With baseURLs above find the server index associated with that URL
function getServerIndex(url: string): number {
const i = baseUrls.findIndex((baseUrl) => url.startsWith(baseUrl));
function getServerIndex(url: URL): number {
const i = baseUrls.findIndex((baseUrl) => url.toString().startsWith(baseUrl));
if (i < 0) {
throw Error(`fetch called with unknown url ${url}`);
throw Error(`fetch called with unknown url ${url.toString()}`);
}
return i;
}
Expand Down

0 comments on commit 7b17f10

Please sign in to comment.