Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

validate-day-test.js 946B

1234567891011121314151617181920212223242526272829303132
  1. 'use strict';
  2. const { expect } = require('chai');
  3. const validate = require('../../src/pattern-validation');
  4. describe('pattern-validation.js', () => {
  5. describe('validate day of month', () => {
  6. it('should fail with invalid day of month', () => {
  7. expect(() => {
  8. validate('* * 32 * *');
  9. }).to.throw('32 is a invalid expression for day of month');
  10. });
  11. it('should not fail with valid day of month', () => {
  12. expect(() => {
  13. validate('0 * * 15 * *');
  14. }).to.not.throw();
  15. });
  16. it('should not fail with * for day of month', () => {
  17. expect(() => {
  18. validate('* * * * * *');
  19. }).to.not.throw();
  20. });
  21. it('should not fail with */2 for day of month', () => {
  22. expect(() => {
  23. validate('* * */2 * *');
  24. }).to.not.throw();
  25. });
  26. });
  27. });