Skip to content

Commit

Permalink
test: ensure RequiredFieldValidation returns MissingParamsError if th…
Browse files Browse the repository at this point in the history
…e field is not provided
  • Loading branch information
Williancc1557 committed Aug 30, 2022
1 parent 13d2f6c commit 4e53eb2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "auth2.0_api",
"version": "1.0.0",
"version": "2.0.0",
"main": "index.js",
"author": "Willian Cavalcanti Coelho",
"license": "MIT",
Expand Down
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"));
});
});

0 comments on commit 4e53eb2

Please sign in to comment.