Add tests for narrowing match & redirect types.

This commit is contained in:
Bauke 2022-10-18 21:54:47 +02:00
parent 81669cc535
commit a4b12334c5
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
1 changed files with 11 additions and 0 deletions

View File

@ -3,7 +3,11 @@
import test from 'ava'; import test from 'ava';
import { import {
matcherTypes,
narrowMatchType,
narrowRedirectType,
parseRedirect, parseRedirect,
redirectTypes,
HostnameRedirect, HostnameRedirect,
Redirect, Redirect,
Redirects, Redirects,
@ -93,3 +97,10 @@ test('Redirect.isMatch', (t) => {
} }
} }
}); });
test('Narrow match & redirect types', (t) => {
t.false(narrowMatchType('invalid'));
t.false(narrowRedirectType('invalid'));
t.true(matcherTypes.every((type) => narrowMatchType(type)));
t.true(redirectTypes.every((type) => narrowRedirectType(type)));
});