generated from agiledev-students-fall2023/generic-project-repository
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #198 from agiledev-students-fall2023/update-tests
Updated tests for login, signup, forgot password, and logout
- Loading branch information
Showing
4 changed files
with
73 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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(); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,14 +12,34 @@ describe("POST for Signup", () => { | |
.request(app) | ||
.post("/signup") | ||
.send({ | ||
email: "testemail", | ||
username: "testuser", | ||
password: "testpassword", | ||
email: "[email protected]", | ||
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("status", "Success"); | ||
expect(res.body).to.have.property("success", true); | ||
expect(res.body).to.have.property("message"); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
|
||
describe("POST /signup", () => { | ||
it("should return a unsuccessful response", (done) => { | ||
chai | ||
.request(app) | ||
.post("/signup") | ||
.send({ | ||
email: "[email protected]", | ||
username: "cindy", | ||
password: "hi", | ||
}) | ||
.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(); | ||
}); | ||
|