您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

validate-month-test.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. 'use strict';
  2. const { expect } = require('chai');
  3. const validate = require('../../src/pattern-validation');
  4. describe('pattern-validation.js', () => {
  5. describe('validate month', () => {
  6. it('should fail with invalid month', () => {
  7. expect( () => {
  8. validate('* * * 13 *');
  9. }).to.throw('13 is a invalid expression for month');
  10. });
  11. it('should fail with invalid month name', () => {
  12. expect( () => {
  13. validate('* * * foo *');
  14. }).to.throw('foo is a invalid expression for month');
  15. });
  16. it('should not fail with valid month', () => {
  17. expect( () => {
  18. validate('* * * 10 *');
  19. }).to.not.throw();
  20. });
  21. it('should not fail with valid month name', () => {
  22. expect( () => {
  23. validate('* * * September *');
  24. }).to.not.throw();
  25. });
  26. it('should not fail with * for month', () => {
  27. expect( () => {
  28. validate('* * * * *');
  29. }).to.not.throw();
  30. });
  31. it('should not fail with */2 for month', () => {
  32. expect( () => {
  33. validate('* * * */2 *');
  34. }).to.not.throw();
  35. });
  36. });
  37. });