/
notes_wf_test.erl
62 lines (40 loc) · 897 Bytes
/
notes_wf_test.erl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
-module (notes_wf_test).
-include_lib ("eunit/include/eunit.hrl").
-include ("notes_data.hrl").
% macros
-define (EXPECT,
Em = em:new (),
em:nothing (Em, notes_random),
em:nothing (Em, wf)).
-define (REPLAY,
em:replay (Em)).
-define (VERIFY,
em:verify (Em)).
-define (TARGET,
notes_data_workspace_server).
% fixtures
session_id_undefined_test () ->
?EXPECT,
em:strict (Em, wf, session,
[ session_id ],
{ return, undefined }),
em:strict (Em, notes_random, random_id,
[],
{ return, "session_id" }),
em:strict (Em, wf, session,
[ session_id, "session_id" ]),
?REPLAY,
?assertEqual (
"session_id",
notes_wf:session_id ()),
?VERIFY.
session_id_already_defined_test () ->
?EXPECT,
em:strict (Em, wf, session,
[ session_id ],
{ return, "session_id" }),
?REPLAY,
?assertEqual (
"session_id",
notes_wf:session_id ()),
?VERIFY.