Skip to content

Commit

Permalink
Merge pull request #740 from wheresrhys/rhys/chores
Browse files Browse the repository at this point in the history
chore: addressed a few trivial todos
  • Loading branch information
wheresrhys authored Jul 24, 2024
2 parents 4e46676 + 177ded9 commit 020948d
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 20 deletions.
1 change: 0 additions & 1 deletion packages/core/src/CallHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ class CallHistory {
routeNames.includes(name),
);
}
// TODO when checking all routes needs to check against all calls
// Can't use array.every because would exit after first failure, which would
// break the logging
return routesToCheck
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ describe('instance management', () => {
.createInstance()
.route('http://a.com', 200, 'george')
.route('http://b.com', 200, 'best');
// TODO overload to also support 'george' or ['george']'
// Probably do the normalization at the FM level
fm.removeRoutes({ names: ['george'] });
expect(fm.router.routes[0].config.name).toBe('best');
});
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/Matchers/body.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import Route from '../../Route.js';
import Router from '../../Router.js';
import { createCallLogFromRequest } from '../../RequestUtils.js';
describe('body matching', () => {
//TODO add a test for matching an asynchronous body
it('should not match if no body provided in request', () => {
const route = new Route({ body: { foo: 'bar' }, response: 200 });

Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/__tests__/Matchers/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ describe('header matching', () => {
}),
).toBe(true);
});
// TODO Are these gonna be supported?
// Should we support it in the fetch-mock matcher API, even though Headers are basically sytrings
it('match multivalue headers', () => {
const route = new Route({
headers: { a: ['b', 'c'] },
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/Matchers/query-string.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ describe('query string matching', () => {
});
});

// TODO may need reform
describe('repeated query strings', () => {
it('match repeated query strings', () => {
const route = new Route({ query: { a: ['b', 'c'] }, response: 200 });
Expand Down
17 changes: 4 additions & 13 deletions packages/core/src/__tests__/Matchers/route-config-object.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,10 @@ describe('matcher object', () => {
});

// TODO this shoudl probably be an error
it.skip('if no url provided, match any url', () => {
const route = new Route({ response: 200 });
expect(route.matcher({ url: 'http://a.com' })).toBe(true);
});

//TODO be stronger on discouraging this
it.skip('deprecated message on using matcherFunction (prefer matcher)', () => {
new Route({
url: 'end:profile',
matcherFunction: (url, opts) =>
opts && opts.headers && opts.headers.authorized === true,
response: 200,
});
it('if no url provided, error', () => {
expect(() => new Route({ response: 200 })).toThrowError(
"fetch-mock: Each route must specify some criteria for matching calls to fetch. To match all calls use '*'",
);
});

it('can match Headers', () => {
Expand Down

0 comments on commit 020948d

Please sign in to comment.