Skip to content

Commit 92e6e36

Browse files
committed
test: added tests for chaining modifyRoute
1 parent b3d1468 commit 92e6e36

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

packages/fetch-mock/src/Router.ts

-7
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@ import { FetchMockConfig } from './FetchMock.js';
1414
import { hasCredentialsInUrl } from './RequestUtils.js';
1515
import type { CallLog } from './CallHistory.js';
1616

17-
// const nullablePerson: Nullable<Person> = {
18-
// name: 'Daffodil',
19-
// email: null,
20-
// age: null,
21-
// admin: true,
22-
// };
23-
2417
export type ResponseConfigProp =
2518
| 'body'
2619
| 'headers'

packages/fetch-mock/src/__tests__/FetchMock/mock-and-spy.test.js

-5
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,6 @@ describe('mock and spy', () => {
141141
const isBrowser = Boolean(globalThis.location);
142142
// avoids getting caught by a cors error
143143
const testUrl = isBrowser ? '/' : 'http://example.com/';
144-
try {
145-
await fm.fetchHandler('testUrl');
146-
} catch (err) {
147-
console.log(err);
148-
}
149144
await expect(fm.fetchHandler(testUrl)).resolves.toBeInstanceOf(Response);
150145
});
151146
});

packages/fetch-mock/src/__tests__/FetchMock/routing.test.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,12 @@ describe('Routing', () => {
251251
});
252252
});
253253
describe('modifyRoute', () => {
254-
// testChainableMethod(`modifyRoute`);
254+
describe('chainability', () => {
255+
beforeEach(() => {
256+
fm.route('http://a.com', 200, 'named');
257+
});
258+
testChainableMethod(`modifyRoute`, 'named', { response: 200 });
259+
});
255260
it('can modify a matcher', async () => {
256261
fm.route('http://a.com/', 200, 'named');
257262
fm.modifyRoute('named', {

0 commit comments

Comments
 (0)