view client/tests/unit/session/session.spec.js @ 935:430d52c2f6ef

client: move layer isolines to be drawn at the top * Move layer isolones to be drawn last (and thus being "on top") so that the bottleneck (position) layer will not interfere that much with the colours. It also allows to set a white background with high opacity on the bottleneck polygon in order to get highly visible isolines.
author Bernhard Reiter <bernhard@intevation.de>
date Mon, 08 Oct 2018 17:20:42 +0200
parents 79db27e3a999
children 0c5cbbafbd94
line wrap: on
line source

import {
  sessionStillActive,
  toMillisFromString
} from "../../../src/application/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);
});