mirror of https://github.com/msgbyte/tailchat
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
3 years ago
|
import {
|
||
|
workboxPluginEntryPattern,
|
||
|
workboxPluginDetailPattern,
|
||
|
} from '../utils';
|
||
4 years ago
|
|
||
3 years ago
|
describe('workboxPluginEntryPattern', () => {
|
||
4 years ago
|
test.each([
|
||
4 years ago
|
// 缓存case
|
||
3 years ago
|
['/plugins/com.msgbyte.foo/index.js', true],
|
||
|
['/plugins/com.msgbyte.foo/bar/index.js', true],
|
||
|
|
||
|
// 不缓存case
|
||
|
['/plugins/com.msgbyte.foo/index-abcde.js', false],
|
||
|
['/plugins/com.msgbyte.foo/index.woff', false],
|
||
|
['/plugins/com.msgbyte.foo/font.woff', false],
|
||
|
['/plugins/a/b/c/d/e/f/g.js', false],
|
||
|
])('%s: %p', (input, output) => {
|
||
|
expect(workboxPluginEntryPattern.test(input)).toBe(output);
|
||
|
});
|
||
|
});
|
||
|
|
||
|
describe('workboxPluginDetailPattern', () => {
|
||
|
test.each([
|
||
|
// 缓存case
|
||
|
['/plugins/com.msgbyte.foo/index-abcde.js', true],
|
||
|
['/plugins/com.msgbyte.foo/bar-a0c1e.js', true],
|
||
|
['/plugins/com.msgbyte.foo.foz/bar-a0c1e.js', true],
|
||
|
['/plugins/com.msgbyte.foo/a/b/c/d/e/f/bar-a0c1e.js', true],
|
||
4 years ago
|
|
||
|
// 不缓存case
|
||
4 years ago
|
['/plugins/com.msgbyte.foo/index.js', false],
|
||
|
['/plugins/com.msgbyte.foo/index.woff', false],
|
||
|
['/plugins/com.msgbyte.foo/font.woff', false],
|
||
4 years ago
|
['/plugins/a/b/c/d/e/f/g.js', false],
|
||
4 years ago
|
])('%s: %p', (input, output) => {
|
||
3 years ago
|
expect(workboxPluginDetailPattern.test(input)).toBe(output);
|
||
4 years ago
|
});
|
||
|
});
|