-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: ensure RequiredFieldValidation returns MissingParamsError if th…
…e field is not provided
- Loading branch information
1 parent
13d2f6c
commit 4e53eb2
Showing
2 changed files
with
20 additions
and
1 deletion.
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
19 changes: 19 additions & 0 deletions
19
...entation/helpers/validators/required-fields-validation/required-fields-validation.spec.ts
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { MissingParamError } from "../../../errors"; | ||
import { RequiredFieldValidation } from "./required-fields-validation"; | ||
|
||
const makeSut = () => { | ||
const sut = new RequiredFieldValidation("email"); | ||
|
||
return { | ||
sut, | ||
}; | ||
}; | ||
|
||
describe("RequiredField validation", () => { | ||
test("should return MissingParamError if the field is not provided", () => { | ||
const { sut } = makeSut(); | ||
const res = sut.validate({}); | ||
|
||
expect(res).toStrictEqual(new MissingParamError("email")); | ||
}); | ||
}); |