Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
unit(consultation): assert two errors due to or validator
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethTrecy committed Sep 12, 2022
1 parent 1c38bc8 commit 1e1829c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 3 additions & 1 deletion routes/api/consultation/update(id).patch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ describe("Controller: PATCH /api/consultation/:id", () => {
await requester.runMiddleware(bodyValidationFunction)

const body = requester.expectFailure(ErrorBag).toJSON()
expect(body).toHaveLength(1)
// There are two errors due to `or` validator
expect(body).toHaveLength(2)
expect(body).toHaveProperty("0.source.pointer", "data.attributes.finishedAt")
expect(body).toHaveProperty("1.source.pointer", "data.attributes.finishedAt")
})
})
1 change: 0 additions & 1 deletion server/validators/logical/or.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export default async function(
constraints.source
)

console.log("verified", value, subrules)
return {
"maySkip": true,
"value": value[constraints.field]
Expand Down

0 comments on commit 1e1829c

Please sign in to comment.