Skip to content

Commit 72393b6

Browse files
committed
1 parent 124cb5c commit 72393b6

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

api/server.test.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,31 @@ describe("[POST] /api/auth/register", () => {
7676
expect(res.body).toMatchObject({username: "george"});
7777
})
7878

79+
test('[5] new user is in db', async () => {
80+
let res = await request(server)
81+
.post("/api/auth/register")
82+
.send({username: "george", password: "pass"});
83+
84+
let id = res.body.id;
85+
86+
expect(res.body).toMatchObject(await db("users").where({id}).first());
87+
88+
res = await request(server)
89+
.post("/api/auth/register")
90+
.send({username: "billy", password: "pass"});
91+
92+
id = res.body.id;
93+
94+
expect(res.body).toMatchObject(await db("users").where({id}).first());
95+
96+
res = await request(server)
97+
.post("/api/auth/register")
98+
.send({username: "matthew", password: "pass"});
99+
100+
id = res.body.id;
101+
102+
expect(res.body).toMatchObject(await db("users").where({id}).first());
103+
104+
})
105+
79106
})

0 commit comments

Comments
 (0)