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

validate-second-test.js 915B

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