@yoroi/common
Version:
The Common package of Yoroi SDK
32 lines (31 loc) • 950 B
JavaScript
;
var _isExpired = require("./is-expired");
const tenSeconds = 10 * 1000;
describe('isExpired', () => {
it.each`
description | cacheInfo | expected
${'expired cache'} | ${{
expires: Date.now() - tenSeconds,
hash: 'hash'
}} | ${true}
${'not expired cache'} | ${{
expires: Date.now() + tenSeconds,
hash: 'hash'
}} | ${false}
${'expired cache as tuple'} | ${[null, {
expires: Date.now() - tenSeconds,
hash: 'hash'
}]} | ${true}
${'not expired cache as tuple'} | ${[null, {
expires: Date.now() + tenSeconds,
hash: 'hash'
}]} | ${false}
`('should return $expected if $description', _ref => {
let {
expected,
cacheInfo
} = _ref;
expect((0, _isExpired.isExpired)(cacheInfo)).toBe(expected);
});
});
//# sourceMappingURL=is-expired.test.js.map