Skip to content

Commit 9012521

Browse files
committed
add test to ensure response password isnt password sent as test bloominstituteoftechnology#5
1 parent 056593d commit 9012521

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

api/server.test.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,26 @@ describe("[POST] /api/auth/register", () => {
9797
expect(res.body.id).toBeTruthy();
9898
})
9999

100+
test('[5] response password does not equal password send (response password is encrypted)', async () => {
101+
let res = await request(server)
102+
.post("/api/auth/register")
103+
.send({username: "george", password: "pass"});
104+
105+
expect(res.body.password).not.toBe("pass");
106+
107+
res = await request(server)
108+
.post("/api/auth/register")
109+
.send({username: "juan", password: "1234"});
110+
111+
expect(res.body.password).not.toBe("1234");
112+
113+
res = await request(server)
114+
.post("/api/auth/register")
115+
.send({username: "matthew", password: "matthew"});
116+
117+
expect(res.body.password).not.toBe("matthew");
118+
})
119+
100120
test('[5] responds with newly created user', async () => {
101121
let res = await request(server).post("/api/auth/register").send({username: "george", password: "pass"});
102122
expect(res.body).toMatchObject({username: "george"});

0 commit comments

Comments
 (0)