This commit is contained in:
Raymond Hill 2021-08-15 11:19:35 -04:00
commit 0ec1204d37
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 30 additions and 0 deletions

View File

@ -39,6 +39,36 @@ process.on('warning', warning => {
let engine = null;
describe('SNFE', () => {
describe('Initialization', () => {
let StaticNetFilteringEngine = null;
beforeEach(async () => {
const module = await createWorld('./index.js', { globals: { URL } });
StaticNetFilteringEngine = module.StaticNetFilteringEngine;
});
it('should not reject on first attempt', async () => {
await StaticNetFilteringEngine.create();
});
it('should reject on second attempt', async () => {
await StaticNetFilteringEngine.create();
await assert.rejects(StaticNetFilteringEngine.create());
});
it('should reject on third attempt', async () => {
await StaticNetFilteringEngine.create();
try {
await StaticNetFilteringEngine.create();
} catch (error) {
}
await assert.rejects(StaticNetFilteringEngine.create());
});
});
describe('Filter loading', () => {
beforeEach(async () => {
const globals = { URL, setTimeout, clearTimeout };