Skip to content

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cindyliang01 committed Dec 5, 2023
1 parent fc48710 commit d13f59e
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
28 changes: 26 additions & 2 deletions back-end/test/forgotPasswordRoute.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,35 @@ describe("POST for Forgot Password", () => {
chai
.request(app)
.post("/forgot-password")
.send({ username: "testuser", password: "testnewpassword" })
.send({
email: "[email protected]",
username: "candy",
newPassword: "candy01",
})
.end((err, res) => {
expect(res).to.have.status(200);
expect(res.body).to.be.a("object");
expect(res.body).to.have.property("status", "Success");
expect(res.body).to.have.property("success", true);
expect(res.body).to.have.property("message");
done();
});
});
});

describe("POST /forgot-password", () => {
it("should return an unsuccessful response", (done) => {
chai
.request(app)
.post("/forgot-password")
.send({
email: "[email protected]",
username: "candy",
newPassword: "candy01",
})
.end((err, res) => {
expect(res).to.have.status(404);
expect(res.body).to.be.a("object");
expect(res.body).to.have.property("success", false);
expect(res.body).to.have.property("message");
done();
});
Expand Down
2 changes: 2 additions & 0 deletions back-end/test/loginRoute.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ describe("POST for Login", () => {
.end((err, res) => {
expect(res).to.have.status(200);
expect(res.body).to.be.a("object");
expect(res.body).to.have.property("success", true);
expect(res.body).to.have.property("message");
done();
});
Expand All @@ -32,6 +33,7 @@ describe("POST for Login", () => {
.end((err, res) => {
expect(res).to.have.status(401);
expect(res.body).to.be.a("object");
expect(res.body).to.have.property("success", false);
expect(res.body).to.have.property("message");
done();
});
Expand Down
1 change: 1 addition & 0 deletions back-end/test/logoutRoute.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ describe(" GET Endpoint for logout", () => {
.end((err, res) => {
expect(res).to.have.status(200);
expect(res.body).to.be.a("object");
expect(res.body).to.have.property("success", true);
done();
});
});
Expand Down
8 changes: 5 additions & 3 deletions back-end/test/signupRoute.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,22 @@ describe("POST for Signup", () => {
.request(app)
.post("/signup")
.send({
email: "wrongnewtest01@gmail9.com",
username: "wrongnewtestuser019",
email: "wrongnewtest01@gmail129.com",
username: "wrongnewtestuser01129",
password: "wrongnewtestpassword",
})
.end((err, res) => {
expect(res).to.have.status(200);
expect(res.body).to.be.a("object");
expect(res.body).to.have.property("success", true);
expect(res.body).to.have.property("message");
done();
});
});
});

describe("POST /signup", () => {
it("should return a unsuccess response", (done) => {
it("should return a unsuccessful response", (done) => {
chai
.request(app)
.post("/signup")
Expand All @@ -38,6 +39,7 @@ describe("POST for Signup", () => {
.end((err, res) => {
expect(res).to.have.status(409);
expect(res.body).to.be.a("object");
expect(res.body).to.have.property("success", false);
expect(res.body).to.have.property("message");
done();
});
Expand Down

0 comments on commit d13f59e

Please sign in to comment.