-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver-tests.txt
More file actions
65 lines (59 loc) · 2.6 KB
/
Copy pathserver-tests.txt
File metadata and controls
65 lines (59 loc) · 2.6 KB
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
63
64
65
> @cs571/server@1.0.0 test
> jest --runInBand
npm : PASS tests/auth.test.js
At line:2 char:1
+ npm test 2>&1 | Out-File -FilePath ..\..\results\server-tests.txt -En ...
+ ~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (PASS tests/auth.test.js:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
POST /register
√ registers a new user and returns a token + eat (447 ms)
√ 400 when username or password is missing (34 ms)
√ 409 when the user already exists (258 ms)
√ 413 when username or password is too long (28 ms)
√ stores the password hashed, never in plaintext (233 ms)
POST /login
√ logs in with correct credentials (382 ms)
√ 401 with an incorrect password (333 ms)
√ 401 for an unknown user (152 ms)
√ 400 when fields are missing (147 ms)
GET /whoami
√ reports not logged in without a token (8 ms)
√ reports the user with a bearer token (140 ms)
√ reports the user via the auth cookie (web flow) (142 ms)
√ logout clears the cookie so whoami reports logged out (141 ms)
PASS tests/messages.test.js
POST /messages
√ 401 when not authenticated (47 ms)
√ posts a message and makes it retrievable, most-recent-first (170 ms)
√ 400 when title or content is missing (135 ms)
√ 404 when posting to a non-existent chatroom (143 ms)
√ 413 when content exceeds the size limit (144 ms)
DELETE /messages
√ deletes a message the caller posted (145 ms)
√ 401 when deleting another user's message (244 ms)
√ 404 when deleting a non-existent message (121 ms)
√ 400 when id is missing or not a number (126 ms)
√ rejects a tampered/invalid token (6 ms)
PASS tests/chatrooms.test.js
GET /chatrooms
√ returns all ten official chatrooms (14 ms)
GET /messages
√ returns seeded messages for a valid chatroom (19 ms)
√ defaults to page 1 when no page is given (7 ms)
√ 400 when no chatroom is specified (9 ms)
√ 404 for a non-existent chatroom (8 ms)
√ 400 for a page number out of range (22 ms)
√ paginates 25 per page across the rolling window (353 ms)
PASS tests/identity.test.js
X-CS571-ID enforcement
√ rejects requests missing the X-CS571-ID header with 401 (11 ms)
√ rejects an empty X-CS571-ID header (8 ms)
√ accepts a valid X-CS571-ID header (5 ms)
√ all three base paths are mounted (16 ms)
Test Suites: 4 passed, 4 total
Tests: 34 passed, 34 total
Snapshots: 0 total
Time: 8.205 s, estimated 40 s
Ran all test suites.