-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c390c0
commit c39223e
Showing
11 changed files
with
118 additions
and
47 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
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
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 |
---|---|---|
|
@@ -5,11 +5,14 @@ import { Connection } from "typeorm"; | |
import { dropStudentTable, initializeApp } from "../../test/utils"; | ||
import { testUser1 } from "../../test/testingData"; | ||
|
||
jest.useRealTimers(); | ||
jest.setTimeout(10000); | ||
|
||
describe("AuthController (e2e)", () => { | ||
let app: INestApplication; | ||
let connection: Connection; | ||
|
||
beforeEach(async () => { | ||
beforeAll(async () => { | ||
app = await initializeApp(); | ||
connection = app.get(Connection); | ||
|
||
|
@@ -30,7 +33,8 @@ describe("AuthController (e2e)", () => { | |
.post("/auth/register") | ||
.send({ | ||
email: "[email protected]", | ||
password: "1234567890", | ||
password: "1234567890a", | ||
passwordConfirm: "1234567890a", | ||
}) | ||
.expect(201); | ||
|
||
|
@@ -50,13 +54,23 @@ describe("AuthController (e2e)", () => { | |
.into(Student) | ||
.values([{ ...testUser1 }]); | ||
|
||
await request(app.getHttpServer()) | ||
.post("/auth/register") | ||
.send(testUser1) | ||
.expect(201); | ||
|
||
await request(app.getHttpServer()) | ||
.post("/auth/register") | ||
.send(testUser1) | ||
.expect(400); | ||
}); | ||
|
||
it("logs in with valid credentials", async () => { | ||
await request(app.getHttpServer()) | ||
.post("/auth/register") | ||
.send(testUser1) | ||
.expect(201); | ||
|
||
const res = await request(app.getHttpServer()) | ||
.post("/auth/login") | ||
.send(testUser1) | ||
|
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
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
Oops, something went wrong.