fix: sonarcloud warning and code cleanup

This commit is contained in:
canove
2021-01-15 07:04:01 -03:00
parent 454fd6ce08
commit a0e6b7b2c7
11 changed files with 40 additions and 45 deletions

View File

@@ -1,6 +1,6 @@
import faker from "faker";
import AppError from "../../../errors/AppError";
import AuthUserService from "../../../services/UserServices/AuthUserSerice";
import AuthUserService from "../../../services/UserServices/AuthUserService";
import CreateUserService from "../../../services/UserServices/CreateUserService";
import { disconnect, truncate } from "../../utils/database";
@@ -18,15 +18,18 @@ describe("Auth", () => {
});
it("should be able to login with an existing user", async () => {
const password = faker.internet.password();
const email = faker.internet.email();
await CreateUserService({
name: faker.name.findName(),
email: "mail@test.com",
password: "hardpassword"
email,
password
});
const response = await AuthUserService({
email: "mail@test.com",
password: "hardpassword"
email,
password
});
expect(response).toHaveProperty("token");
@@ -49,7 +52,7 @@ describe("Auth", () => {
await CreateUserService({
name: faker.name.findName(),
email: "mail@test.com",
password: "hardpassword"
password: faker.internet.password()
});
try {