Mercurial > gemma
annotate client/tests/unit/session/session.spec.js @ 1242:da99d4560fd4
feat: import sounding results
Sends now bottleneck, importdate, depthreference over the wire.
Changed success message to "starting import for ...".
In case of an error, display errormessages.
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Wed, 21 Nov 2018 09:38:51 +0100 |
parents | 79db27e3a999 |
children | 0c5cbbafbd94 |
rev | line source |
---|---|
165
4bf2173748f3
refactor: extracted the string to milisecondconversion
Thomas Junk <thomas.junk@intevation.de>
parents:
164
diff
changeset
|
1 import { |
4bf2173748f3
refactor: extracted the string to milisecondconversion
Thomas Junk <thomas.junk@intevation.de>
parents:
164
diff
changeset
|
2 sessionStillActive, |
4bf2173748f3
refactor: extracted the string to milisecondconversion
Thomas Junk <thomas.junk@intevation.de>
parents:
164
diff
changeset
|
3 toMillisFromString |
660 | 4 } from "../../../src/application/lib/session"; |
162
9908260d1e6a
Refactor: Login expiry refactored to lib
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
5 |
9908260d1e6a
Refactor: Login expiry refactored to lib
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
6 test("No session counts as expired session", () => { |
9908260d1e6a
Refactor: Login expiry refactored to lib
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
7 expect(sessionStillActive(null)).toBe(false); |
9908260d1e6a
Refactor: Login expiry refactored to lib
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
8 }); |
9908260d1e6a
Refactor: Login expiry refactored to lib
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
9 |
9908260d1e6a
Refactor: Login expiry refactored to lib
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
10 test("Session expired", () => { |
165
4bf2173748f3
refactor: extracted the string to milisecondconversion
Thomas Junk <thomas.junk@intevation.de>
parents:
164
diff
changeset
|
11 const expired = Date.now() - 60000; |
162
9908260d1e6a
Refactor: Login expiry refactored to lib
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
12 expect(sessionStillActive(expired)).toBe(false); |
9908260d1e6a
Refactor: Login expiry refactored to lib
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
13 }); |
9908260d1e6a
Refactor: Login expiry refactored to lib
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
14 |
9908260d1e6a
Refactor: Login expiry refactored to lib
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
15 test("Session alive", () => { |
9908260d1e6a
Refactor: Login expiry refactored to lib
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
16 const active = Date.now() + 60000; |
9908260d1e6a
Refactor: Login expiry refactored to lib
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
17 expect(sessionStillActive(active)).toBe(true); |
9908260d1e6a
Refactor: Login expiry refactored to lib
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
18 }); |
163
30c212a6f580
fix: Bugfix for session evaluation
Thomas Junk <thomas.junk@intevation.de>
parents:
162
diff
changeset
|
19 |
30c212a6f580
fix: Bugfix for session evaluation
Thomas Junk <thomas.junk@intevation.de>
parents:
162
diff
changeset
|
20 test("Session alive with string", () => { |
165
4bf2173748f3
refactor: extracted the string to milisecondconversion
Thomas Junk <thomas.junk@intevation.de>
parents:
164
diff
changeset
|
21 const active = "" + Date.now() / 1000 + 60000; |
4bf2173748f3
refactor: extracted the string to milisecondconversion
Thomas Junk <thomas.junk@intevation.de>
parents:
164
diff
changeset
|
22 expect(sessionStillActive(toMillisFromString(active))).toBe(true); |
163
30c212a6f580
fix: Bugfix for session evaluation
Thomas Junk <thomas.junk@intevation.de>
parents:
162
diff
changeset
|
23 }); |
30c212a6f580
fix: Bugfix for session evaluation
Thomas Junk <thomas.junk@intevation.de>
parents:
162
diff
changeset
|
24 |
30c212a6f580
fix: Bugfix for session evaluation
Thomas Junk <thomas.junk@intevation.de>
parents:
162
diff
changeset
|
25 test("Session expired with string", () => { |
165
4bf2173748f3
refactor: extracted the string to milisecondconversion
Thomas Junk <thomas.junk@intevation.de>
parents:
164
diff
changeset
|
26 const expired = "" + Date.now() / 1000 - 60000; |
4bf2173748f3
refactor: extracted the string to milisecondconversion
Thomas Junk <thomas.junk@intevation.de>
parents:
164
diff
changeset
|
27 expect(sessionStillActive(toMillisFromString(expired))).toBe(false); |
163
30c212a6f580
fix: Bugfix for session evaluation
Thomas Junk <thomas.junk@intevation.de>
parents:
162
diff
changeset
|
28 }); |