UNPKG

@yoroi/common

Version:
31 lines (30 loc) 925 B
"use strict"; 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', ({ expected, cacheInfo }) => { expect((0, _isExpired.isExpired)(cacheInfo)).toBe(expected); }); }); //# sourceMappingURL=is-expired.test.js.map