Skip to content

Commit

Permalink
Replace beforeEach with beforeAll
Browse files Browse the repository at this point in the history
  • Loading branch information
laurogripa committed Oct 10, 2024
1 parent a32f63b commit 00eb571
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions tests/courses.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ describe("Setting API Server up...", () => {
server = app.listen(PORT, done);
});

beforeAll(async () => {
await mongoDBsetup(MONGODB_DATABASE_NAME);
});

afterAll(async () => {
await mongoDBsetup(MONGODB_DATABASE_NAME, true);
return server && server.close();
});

beforeEach(async () => {
await mongoDBsetup(MONGODB_DATABASE_NAME);
});

describe("Courses", () => {
it("Create a Course (POST /course)", async () => {
const lesson = await LessonModel.create({
Expand Down
8 changes: 4 additions & 4 deletions tests/users.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ describe("Setting API Server up...", () => {
server = app.listen(PORT, done);
});

beforeAll(async () => {
await mongoDBsetup(MONGODB_DATABASE_NAME);
});

afterAll(async () => {
await mongoDBsetup(MONGODB_DATABASE_NAME, true);
return server && server.close();
});

beforeEach(async () => {
await mongoDBsetup(MONGODB_DATABASE_NAME);
});

describe("Users", () => {
it("Create a User (POST /users)", async () => {
const email = "user1@polkadot.education";
Expand Down

0 comments on commit 00eb571

Please sign in to comment.