Skip to content

Commit

Permalink
(fga-eps-mds/2023-1-CAPJu-Doc#122) - Testa caso de senha errada
Browse files Browse the repository at this point in the history
Co-authored-by: OscarDeBrito <[email protected]>
Co-authored-by: YanWerlley <[email protected]>
Co-authored-by: Vinícius Vieira de Souza <[email protected]>
  • Loading branch information
4 people committed Jul 3, 2023
1 parent 043210a commit a805b07
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/tests/__tests__/test_user_routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,32 @@ describe("user endpoints", () => {
expect(response.body.message).toBe("Usuário inexistente");
});

it("should return error for wrong password", async () => {
const testUser = {
fullName: "Nomen Nomes",
cpf: "86891382424",
email: "[email protected]",
password: "spw123456",
idUnit: 1,
idRole: 3,
};

await supertest(app).post("/newUser").send(testUser);

await supertest(app).post(`/acceptRequest/${testUser.cpf}`);

const response = await supertest(app)
.post("/login")
.send({
cpf: testUser.cpf,
password: "senha_qualquer",
})
.expect(401);

expect(response.body.message).toBe("Senha ou usuário incorretos");
expect(response.body.error).toBe("Impossível autenticar");
});

test("get all users", async () => {
const testUser = {
fullName: "Nomenni Nomesos",
Expand Down

0 comments on commit a805b07

Please sign in to comment.