Skip to content

Commit

Permalink
feat: auth service 單元測試加上測試後復原資料庫
Browse files Browse the repository at this point in the history
  • Loading branch information
a20688392 committed Jun 4, 2023
1 parent 43664ea commit edfdf64
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/auth/auth.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ describe("AuthService", () => {
expect(user.statusCode).toEqual(HttpStatus.CREATED);
expect(user.message).toEqual("創建成功");
});
afterEach(async () => {
if (userRepository && userRepository.clear) {
await userRepository.clear();
}
});
it("應該會發生 email、account 已被註冊衝突", async () => {
const createUserDto1: CreateUserDto = {
email: "[email protected]",
Expand All @@ -68,6 +73,11 @@ describe("AuthService", () => {
});
}
});
afterEach(async () => {
if (userRepository && userRepository.clear) {
await userRepository.clear();
}
});
it("應該會發生 email 已被註冊衝突", async () => {
const test_data1: CreateUserDto = {
email: "[email protected]",
Expand Down Expand Up @@ -95,6 +105,11 @@ describe("AuthService", () => {
});
}
});
afterEach(async () => {
if (userRepository && userRepository.clear) {
await userRepository.clear();
}
});
it("應該會發生 account 已被註冊衝突", async () => {
const test_data1: CreateUserDto = {
email: "[email protected]",
Expand Down

0 comments on commit edfdf64

Please sign in to comment.