describe('verifier', () => {
const TODAY = moment().day();
// 이 테스트는 항상 실행되지만, 아무것도 수행하지 않을 수 있다.
test('on weekends, throws exceptions', () => {
if ([SATURDAY, SUNDAY].includes(TODAY)) { ➊
expect(() => verifyPassword('anything', [])).toThrowError(
"It's the weekend!"
);
}
});
// 이 테스트는 주말에만 실행된다.
if ([SATURDAY, SUNDAY].includes(TODAY)) { ➋
test('on a weekend, throws an error', () => {
expect(() => verifyPassword('anything', [])).toThrow("It's the weekend!");
});
}
});
➊ test 내부에서 날짜를 비교한다.
➋ test 외부에서 날짜를 비교한다.