@cnamts/vue-dot
Version:
Implementation of our Design System for the French Health Insurance
24 lines (18 loc) • 515 B
text/typescript
import { email, emailFn } from '../';
describe('email', () => {
it('returns an error when the email is invalid', () => {
expect(typeof email('test')).toBe('string');
});
it('returns true when the email is valid', () => {
expect(email('test@example.com')).toBe(true);
});
it('returns true if the value is falsy', () => {
expect(email('')).toBe(true);
});
it('works with custom error messages', () => {
const rule = emailFn({
default: 'test'
});
expect(rule('test')).toBe('test');
});
});