This commit is contained in:
@ -52,7 +52,7 @@ describe ('blacklist', () => {
|
||||
jasmine.clock ()
|
||||
.tick (5000);
|
||||
blacklist.add_signature ('baz');
|
||||
blacklist.clear_before (new Date (Date.now () - 100));
|
||||
blacklist.clear (Date.now () - 100);
|
||||
expect (blacklist.is_valid ('foo'))
|
||||
.toBeTrue ();
|
||||
expect (blacklist.is_valid ('bar'))
|
||||
@ -61,7 +61,27 @@ describe ('blacklist', () => {
|
||||
.toBeFalse ();
|
||||
});
|
||||
|
||||
it ('should clear all', () => {
|
||||
blacklist.add_signature ('foo');
|
||||
blacklist.add_signature ('bar');
|
||||
blacklist.add_signature ('baz');
|
||||
expect (blacklist.is_valid ('foo'))
|
||||
.toBeFalse ();
|
||||
expect (blacklist.is_valid ('bar'))
|
||||
.toBeFalse ();
|
||||
expect (blacklist.is_valid ('baz'))
|
||||
.toBeFalse ();
|
||||
blacklist.clear ();
|
||||
expect (blacklist.is_valid ('foo'))
|
||||
.toBeTrue ();
|
||||
expect (blacklist.is_valid ('bar'))
|
||||
.toBeTrue ();
|
||||
expect (blacklist.is_valid ('baz'))
|
||||
.toBeTrue ();
|
||||
});
|
||||
|
||||
it ('should export and import data', () => {
|
||||
blacklist.add_signature ('baz');
|
||||
const exp = blacklist.export_blacklist ();
|
||||
// eslint-disable-next-line dot-notation
|
||||
expect (blacklist['_signatures'])
|
||||
|
@ -179,4 +179,16 @@ describe ('key store', () => {
|
||||
expect (() => ks.import_verification_data (exp))
|
||||
.toThrowError ('cannot import to the same instance');
|
||||
});
|
||||
|
||||
it ('should clear all', () => {
|
||||
// eslint-disable-next-line dot-notation
|
||||
expect (Object.keys (ks['_keys']).length)
|
||||
.toBeGreaterThan (0);
|
||||
const instance = ks.instance_id;
|
||||
ks.reset_instance ();
|
||||
// eslint-disable-next-line dot-notation
|
||||
expect (Object.keys (ks['_keys']).length)
|
||||
.toEqual (0);
|
||||
expect (instance).not.toEqual (ks.instance_id);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user