+ Thank you for your message! I will get back to you as soon as possible. 😀 +
+ ); +} diff --git a/src/app/contact/utils.test.ts b/src/app/contact/utils.test.ts new file mode 100644 index 0000000..4560742 --- /dev/null +++ b/src/app/contact/utils.test.ts @@ -0,0 +1,25 @@ +import { isValid } from "../forms/validator"; +import { Contact } from "./models"; +import { fields, isContact } from "./utils"; + +jest.mock("../forms/validator", () => ({ + isValid: jest.fn(), +})); + +describe("isContact", () => { + it("should call isValid", () => { + const contact: Contact = { + name: "name", + email: "email", + subject: "subject", + text: "text", + }; + + isContact(contact); + + expect(isValid).toHaveBeenCalledWith({ + obj: contact, + fields, + }); + }); +}); diff --git a/src/app/contact/utils.ts b/src/app/contact/utils.ts new file mode 100644 index 0000000..987960d --- /dev/null +++ b/src/app/contact/utils.ts @@ -0,0 +1,40 @@ +import { Fields } from "../forms/models"; +import { isValid } from "../forms/validator"; +import { Contact } from "./models"; + +export const fields: Fields