forked from fga-eps-mds/2022-2-CAPJu-Service
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(fga-eps-mds/2023-1-CAPJu-Doc#122) - Testa caso de senha errada
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
1 parent
043210a
commit a805b07
Showing
1 changed file
with
26 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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", | ||
|