mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
library regexp tests added
This commit is contained in:
parent
0aa6b06df2
commit
3354f79caf
1 changed files with 46 additions and 1 deletions
|
|
@ -112,7 +112,52 @@ describe('routesRegexp', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
//TODO library route regexp
|
describe('library route regexp', () => {
|
||||||
|
it('match /library', async () => {
|
||||||
|
expect(Array.from('/library'.match(routesRegexp.library.regexp)))
|
||||||
|
.toEqual(['/library', undefined, undefined]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('match /library//', async () => {
|
||||||
|
expect(Array.from('/library//'.match(routesRegexp.library.regexp)))
|
||||||
|
.toEqual(['/library//', '', '']);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('match /library/1/', async () => {
|
||||||
|
expect(Array.from('/library/1/'.match(routesRegexp.library.regexp)))
|
||||||
|
.toEqual(['/library/1/', '1', '']);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('match /library//2', async () => {
|
||||||
|
expect(Array.from('/library//2'.match(routesRegexp.library.regexp)))
|
||||||
|
.toEqual(['/library//2', '', '2']);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('match /library/1/2', async () => {
|
||||||
|
expect(Array.from('/library/1/2'.match(routesRegexp.library.regexp)))
|
||||||
|
.toEqual(['/library/1/2', '1', '2']);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('not match /library/', async () => {
|
||||||
|
expect('/library/'.match(routesRegexp.library.regexp))
|
||||||
|
.toBe(null);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('not match /library///', async () => {
|
||||||
|
expect('/library///'.match(routesRegexp.library.regexp))
|
||||||
|
.toBe(null);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('not match /library/1', async () => {
|
||||||
|
expect('/library/1'.match(routesRegexp.library.regexp))
|
||||||
|
.toBe(null);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('not match /library/1/2/', async () => {
|
||||||
|
expect('/library/1/2/'.match(routesRegexp.library.regexp))
|
||||||
|
.toBe(null);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('search route regexp', () => {
|
describe('search route regexp', () => {
|
||||||
it('match /search', async () => {
|
it('match /search', async () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue