improve debug, redis storage structure
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@ -19,33 +19,46 @@ describe ('redis', () => {
|
||||
clock_setup ();
|
||||
});
|
||||
|
||||
let iat1 = 0;
|
||||
let iat2 = 0;
|
||||
let k1 = '';
|
||||
let k2 = '';
|
||||
let i1 = '';
|
||||
let i2 = '';
|
||||
|
||||
afterAll (() => clock_finalize ());
|
||||
|
||||
it ('should write and read all keys', async () => {
|
||||
const iat1 = (new Date)
|
||||
it ('should generate two keys', async () => {
|
||||
iat1 = (new Date)
|
||||
.getTime () / 1000;
|
||||
await ks.get_sign_key (iat1, frame);
|
||||
const k1 = await ks.get_key (iat1);
|
||||
k1 = await ks.get_key (iat1);
|
||||
|
||||
jasmine.clock ()
|
||||
.tick (frame * 1000);
|
||||
|
||||
const iat2 = (new Date)
|
||||
iat2 = (new Date)
|
||||
.getTime () / 1000;
|
||||
await ks.get_sign_key (iat2, frame);
|
||||
const k2 = await ks.get_key (iat2);
|
||||
k2 = await ks.get_key (iat2);
|
||||
// eslint-disable-next-line dot-notation
|
||||
const index1 = ks['get_index'] (iat1);
|
||||
i1 = ks['get_index'] (iat1);
|
||||
// eslint-disable-next-line dot-notation
|
||||
const index2 = ks['get_index'] (iat2);
|
||||
i2 = ks['get_index'] (iat2);
|
||||
});
|
||||
|
||||
it ('should have two keys in redis', async () => {
|
||||
// eslint-disable-next-line dot-notation
|
||||
expect (JSON.parse (await redis['_redis']?.get (index1) as string).key)
|
||||
expect (JSON.parse (await redis['_redis']
|
||||
?.get (`keystore_${i1}`) as string).key)
|
||||
.toEqual (k1);
|
||||
// eslint-disable-next-line dot-notation
|
||||
expect (JSON.parse (await redis['_redis']?.get (index2) as string).key)
|
||||
expect (JSON.parse (await redis['_redis']
|
||||
?.get (`keystore_${i2}`) as string).key)
|
||||
.toEqual (k2);
|
||||
});
|
||||
|
||||
it ('should read two keys with a new instance', async () => {
|
||||
const old_instance = ks.instance_id;
|
||||
ks.reset_instance ();
|
||||
expectAsync (ks.get_key (iat1, old_instance))
|
||||
|
Reference in New Issue
Block a user