UNPKG

stitch-ui

Version:

33 lines (28 loc) 891 B
/* global it, describe, beforeEach, expect */ import validateUserPass from "../validation"; describe("validateUserPass", () => { let input; beforeEach(() => { input = { email: "email", password: "password", confirmPassword: "password" }; }); it("Should return error when email is not long enough", () => { input.email = ""; expect(validateUserPass(input)).not.toEqual(null); }); it("Should return error when password is not long enough", () => { input.password = ""; expect(validateUserPass(input)).not.toEqual(null); }); it("Should return error when passwords are not the same", () => { input.password = "password"; input.confirmPassword = "passwrod"; expect(validateUserPass(input)).not.toEqual(null); }); it("Should return null when valid", () => { expect(validateUserPass(input)).toEqual(null); }); });