Skip to content

Commit

Permalink
refactor(@yourssu/utils): change isEmail.test
Browse files Browse the repository at this point in the history
  • Loading branch information
owl1753 committed Sep 3, 2024
1 parent d63976a commit 9a0b342
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions packages/utils/src/isEmail.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ import { isEmail } from './isEmail';

describe('isEmail', () => {
it('should return full Email if given value is valid', () => {
expect(isEmail('[email protected]')).toEqual('[email protected]');
expect(isEmail('stella', '@yourssu.com')).toEqual('[email protected]');
expect(isEmail('[email protected]')).toEqual(true);
expect(isEmail('stella', '@yourssu.com')).toEqual(true);
});

it('should return Error if given value is not valid', () => {
expect(() => isEmail('')).toThrowError('given value is not valid');
expect(() => isEmail('stella')).toThrowError('given value is not valid');
expect(() => isEmail('1234')).toThrowError('given value is not valid');
expect(() => isEmail('stella@')).toThrowError('given value is not valid');
expect(() => isEmail('stella@yourssu')).toThrowError('given value is not valid');
expect(() => isEmail('stella@yourssu.')).toThrowError('given value is not valid');
expect(() => isEmail('[email protected]')).toThrowError('given value is not valid');
expect(() => isEmail('[email protected]')).toThrowError('given value is not valid');
expect(() => isEmail('stella')).toThrowError('given value is not valid');
expect(() => isEmail('', '@naver.com')).toThrowError('given value is not valid');
expect(() => isEmail('@naver.com')).toThrowError('given value is not valid');
expect(() => isEmail('stella', '@yourssu.com123')).toThrowError('given value is not valid');
expect(() => isEmail('stella', '@yourssu')).toThrowError('given value is not valid');
expect(isEmail('')).toEqual(false);
expect(isEmail('stella')).toEqual(false);
expect(isEmail('1234')).toEqual(false);
expect(isEmail('stella@')).toEqual(false);
expect(isEmail('stella@yourssu')).toEqual(false);
expect(isEmail('stella@yourssu.')).toEqual(false);
expect(isEmail('[email protected]')).toEqual(false);
expect(isEmail('[email protected]')).toEqual(false);
expect(isEmail('stella')).toEqual(false);
expect(isEmail('', '@naver.com')).toEqual(false);
expect(isEmail('@naver.com')).toEqual(false);
expect(isEmail('stella', '@yourssu.com123')).toEqual(false);
expect(isEmail('stella', '@yourssu')).toEqual(false);
});
});

0 comments on commit 9a0b342

Please sign in to comment.