Skip to content

Commit 6720a98

Browse files
committed
test: added failing test for host: matcher
1 parent 661b98f commit 6720a98

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/fetch-mock/src/__tests__/Matchers/url.test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ describe('url matching', () => {
3939
expect(route.matcher({ url: 'http://a.com/paths' })).toBe(true);
4040
});
4141

42+
it('match host: keyword', () => {
43+
const route = new Route({
44+
url: 'host:a.b.com',
45+
response: 200,
46+
});
47+
48+
expect(route.matcher({ url: 'http://b.com/path' })).toBe(false);
49+
expect(route.matcher({ url: 'http://a.com/path' })).toBe(false);
50+
expect(route.matcher({ url: 'http://a.b.com/path' })).toBe(true);
51+
expect(route.matcher({ url: 'https://a.bcom/path' })).toBe(true);
52+
});
53+
4254
it('match end: keyword', () => {
4355
const route = new Route({ url: 'end:com/path', response: 200 });
4456
expect(route.matcher({ url: 'http://a.com/paths' })).toBe(false);

0 commit comments

Comments
 (0)