forked from soo-utem/benr2423-week07
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser.test.js
42 lines (35 loc) · 951 Bytes
/
user.test.js
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
const MongoClient = require("mongodb").MongoClient;
const User = require("./user")
describe("User Account", () => {
let client;
beforeAll(async () => {
client = await MongoClient.connect(
"my-mongodb+srv-connection-string",
{ useNewUrlParser: true },
);
User.injectDB(client);
})
afterAll(async () => {
await client.close();
})
test("New user registration", async () => {
const res = await User.register("test", "test")
expect().toBe()
})
test("Duplicate username", async () => {
const res = await User.register("test", "test")
expect().toBe()
})
test("User login invalid username", async () => {
const res = await User.login("test", "test")
expect().toBe()
})
test("User login invalid password", async () => {
const res = await User.login("test", "test")
expect().toBe()
})
test("User login successfully", async () => {
const res = await User.login("test", "test")
expect(res).toBe(true)
})
});