Mercurial > gemma
view client/tests/unit/session/session.spec.js @ 317:5cb18bedb3a9
Simplified internal password generator.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 02 Aug 2018 10:18:25 +0200 |
parents | 4bf2173748f3 |
children | 79db27e3a999 |
line wrap: on
line source
import { sessionStillActive, toMillisFromString } from "../../../src/lib/session"; test("No session counts as expired session", () => { expect(sessionStillActive(null)).toBe(false); }); test("Session expired", () => { const expired = Date.now() - 60000; expect(sessionStillActive(expired)).toBe(false); }); test("Session alive", () => { const active = Date.now() + 60000; expect(sessionStillActive(active)).toBe(true); }); test("Session alive with string", () => { const active = "" + Date.now() / 1000 + 60000; expect(sessionStillActive(toMillisFromString(active))).toBe(true); }); test("Session expired with string", () => { const expired = "" + Date.now() / 1000 - 60000; expect(sessionStillActive(toMillisFromString(expired))).toBe(false); });