stremio-web/tests/routesRegexp.spec.js
2019-12-09 13:15:47 +02:00

32 lines
979 B
JavaScript

const routesRegexp = require('../src/common/routesRegexp');
describe('routesRegexp', () => {
describe('intro route regexp', () => {
it('match /intro', async () => {
expect(Array.from('/intro'.match(routesRegexp.intro.regexp)))
.toEqual(['/intro']);
});
it('match /intro/', async () => {
expect(Array.from('/intro/'.match(routesRegexp.intro.regexp)))
.toEqual(['/intro/']);
});
it('not match /intro/$', async () => {
expect('/intro/$'.match(routesRegexp.intro.regexp))
.toBe(null);
});
});
describe('board route regexp', () => {
it('match /', async () => {
expect(Array.from('/'.match(routesRegexp.board.regexp)))
.toEqual(['/']);
});
it('not match /$', async () => {
expect('/$'.match(routesRegexp.board.regexp))
.toBe(null);
});
});
});