pgdata und yaml
This commit is contained in:
32
app/node_modules/node-cron/test/pattern-validation/validate-day-test.js
generated
vendored
Normal file
32
app/node_modules/node-cron/test/pattern-validation/validate-day-test.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
const { expect } = require('chai');
|
||||
const validate = require('../../src/pattern-validation');
|
||||
|
||||
describe('pattern-validation.js', () => {
|
||||
describe('validate day of month', () => {
|
||||
it('should fail with invalid day of month', () => {
|
||||
expect(() => {
|
||||
validate('* * 32 * *');
|
||||
}).to.throw('32 is a invalid expression for day of month');
|
||||
});
|
||||
|
||||
it('should not fail with valid day of month', () => {
|
||||
expect(() => {
|
||||
validate('0 * * 15 * *');
|
||||
}).to.not.throw();
|
||||
});
|
||||
|
||||
it('should not fail with * for day of month', () => {
|
||||
expect(() => {
|
||||
validate('* * * * * *');
|
||||
}).to.not.throw();
|
||||
});
|
||||
|
||||
it('should not fail with */2 for day of month', () => {
|
||||
expect(() => {
|
||||
validate('* * */2 * *');
|
||||
}).to.not.throw();
|
||||
});
|
||||
});
|
||||
});
|
||||
38
app/node_modules/node-cron/test/pattern-validation/validate-hours-test.js
generated
vendored
Normal file
38
app/node_modules/node-cron/test/pattern-validation/validate-hours-test.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
'use strict';
|
||||
|
||||
const { expect } = require('chai');
|
||||
const validate = require('../../src/pattern-validation');
|
||||
|
||||
describe('pattern-validation.js', () => {
|
||||
describe('validate hour', () => {
|
||||
it('should fail with invalid hour', () => {
|
||||
expect(() => {
|
||||
validate('* 25 * * *');
|
||||
}).to.throw('25 is a invalid expression for hour');
|
||||
});
|
||||
|
||||
it('should not fail with valid hour', () => {
|
||||
expect(() => {
|
||||
validate('* 12 * * *');
|
||||
}).to.not.throw();
|
||||
});
|
||||
|
||||
it('should not fail with * for hour', () => {
|
||||
expect(() => {
|
||||
validate('* * * * * *');
|
||||
}).to.not.throw();
|
||||
});
|
||||
|
||||
it('should not fail with */2 for hour', () => {
|
||||
expect(() => {
|
||||
validate('* */2 * * *');
|
||||
}).to.not.throw();
|
||||
});
|
||||
|
||||
it('should accept range for hours', () => {
|
||||
expect(() => {
|
||||
validate('* 3-20 * * *');
|
||||
}).to.not.throw();
|
||||
});
|
||||
});
|
||||
});
|
||||
32
app/node_modules/node-cron/test/pattern-validation/validate-minute-test.js
generated
vendored
Normal file
32
app/node_modules/node-cron/test/pattern-validation/validate-minute-test.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
const { expect } = require('chai');
|
||||
const validate = require('../../src/pattern-validation');
|
||||
|
||||
describe('pattern-validation.js', () => {
|
||||
describe('validate minutes', () => {
|
||||
it('should fail with invalid minute', () => {
|
||||
expect(() => {
|
||||
validate('63 * * * *');
|
||||
}).to.throw('63 is a invalid expression for minute');
|
||||
});
|
||||
|
||||
it('should not fail with valid minute', () => {
|
||||
expect(() => {
|
||||
validate('30 * * * *');
|
||||
}).to.not.throw();
|
||||
});
|
||||
|
||||
it('should not fail with *', () => {
|
||||
expect(() => {
|
||||
validate('* * * * *');
|
||||
}).to.not.throw();
|
||||
});
|
||||
|
||||
it('should not fail with */2', () => {
|
||||
expect(() => {
|
||||
validate('*/2 * * * *');
|
||||
}).to.not.throw();
|
||||
});
|
||||
});
|
||||
});
|
||||
44
app/node_modules/node-cron/test/pattern-validation/validate-month-test.js
generated
vendored
Normal file
44
app/node_modules/node-cron/test/pattern-validation/validate-month-test.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
'use strict';
|
||||
|
||||
const { expect } = require('chai');
|
||||
const validate = require('../../src/pattern-validation');
|
||||
|
||||
describe('pattern-validation.js', () => {
|
||||
describe('validate month', () => {
|
||||
it('should fail with invalid month', () => {
|
||||
expect( () => {
|
||||
validate('* * * 13 *');
|
||||
}).to.throw('13 is a invalid expression for month');
|
||||
});
|
||||
|
||||
it('should fail with invalid month name', () => {
|
||||
expect( () => {
|
||||
validate('* * * foo *');
|
||||
}).to.throw('foo is a invalid expression for month');
|
||||
});
|
||||
|
||||
it('should not fail with valid month', () => {
|
||||
expect( () => {
|
||||
validate('* * * 10 *');
|
||||
}).to.not.throw();
|
||||
});
|
||||
|
||||
it('should not fail with valid month name', () => {
|
||||
expect( () => {
|
||||
validate('* * * September *');
|
||||
}).to.not.throw();
|
||||
});
|
||||
|
||||
it('should not fail with * for month', () => {
|
||||
expect( () => {
|
||||
validate('* * * * *');
|
||||
}).to.not.throw();
|
||||
});
|
||||
|
||||
it('should not fail with */2 for month', () => {
|
||||
expect( () => {
|
||||
validate('* * * */2 *');
|
||||
}).to.not.throw();
|
||||
});
|
||||
});
|
||||
});
|
||||
19
app/node_modules/node-cron/test/pattern-validation/validate-pattern-type.js
generated
vendored
Normal file
19
app/node_modules/node-cron/test/pattern-validation/validate-pattern-type.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
const { expect } = require('chai');
|
||||
const Task = require('../../src/task');
|
||||
|
||||
describe('Task', () => {
|
||||
it('should accept a function', () => {
|
||||
expect(() => {
|
||||
new Task(() => {});
|
||||
}).to.not.throw();
|
||||
});
|
||||
|
||||
it('should fail without a function', () => {
|
||||
expect(() => {
|
||||
new Task([]);
|
||||
}).to.throw('execution must be a function');
|
||||
});
|
||||
|
||||
});
|
||||
32
app/node_modules/node-cron/test/pattern-validation/validate-second-test.js
generated
vendored
Normal file
32
app/node_modules/node-cron/test/pattern-validation/validate-second-test.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
const { expect } = require('chai');
|
||||
const validate = require('../../src/pattern-validation');
|
||||
|
||||
describe('pattern-validation.js', () => {
|
||||
describe('validate seconds', () => {
|
||||
it('should fail with invalid second', () => {
|
||||
expect(() => {
|
||||
validate('63 * * * * *');
|
||||
}).to.throw('63 is a invalid expression for second');
|
||||
});
|
||||
|
||||
it('should not fail with valid second', () => {
|
||||
expect(() => {
|
||||
validate('30 * * * * *');
|
||||
}).to.not.throw();
|
||||
});
|
||||
|
||||
it('should not fail with * for second', () => {
|
||||
expect(() => {
|
||||
validate('* * * * * *');
|
||||
}).to.not.throw();
|
||||
});
|
||||
|
||||
it('should not fail with */2 for second', () => {
|
||||
expect(() => {
|
||||
validate('*/2 * * * * *');
|
||||
}).to.not.throw();
|
||||
});
|
||||
});
|
||||
});
|
||||
24
app/node_modules/node-cron/test/pattern-validation/validate-test.js
generated
vendored
Normal file
24
app/node_modules/node-cron/test/pattern-validation/validate-test.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
const { expect } = require('chai');
|
||||
const validate = require('../../src/pattern-validation');
|
||||
|
||||
describe('pattern-validation', () => {
|
||||
it('should succeed with a valid expression', () => {
|
||||
expect(() => {
|
||||
validate('59 * * * *');
|
||||
}).to.not.throw();
|
||||
});
|
||||
|
||||
it('should fail with an invalid expression', () => {
|
||||
expect(() => {
|
||||
validate('60 * * * *');
|
||||
}).to.throw('60 is a invalid expression for minute');
|
||||
});
|
||||
|
||||
it('should fail without a string', () => {
|
||||
expect(() => {
|
||||
validate(50);
|
||||
}).to.throw('pattern must be a string!');
|
||||
});
|
||||
});
|
||||
56
app/node_modules/node-cron/test/pattern-validation/validate-week-day-test.js
generated
vendored
Normal file
56
app/node_modules/node-cron/test/pattern-validation/validate-week-day-test.js
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
'use strict';
|
||||
|
||||
const { expect } = require('chai');
|
||||
const validate = require('../../src/pattern-validation');
|
||||
|
||||
describe('pattern-validation.js', () => {
|
||||
describe('validate week day', () => {
|
||||
it('should fail with invalid week day', () => {
|
||||
expect(() => {
|
||||
validate('* * * * 9');
|
||||
}).to.throw('9 is a invalid expression for week day');
|
||||
});
|
||||
|
||||
it('should fail with invalid week day name', () => {
|
||||
expect(() => {
|
||||
validate('* * * * foo');
|
||||
}).to.throw('foo is a invalid expression for week day');
|
||||
});
|
||||
|
||||
it('should not fail with valid week day', () => {
|
||||
expect(() => {
|
||||
validate('* * * * 5');
|
||||
}).to.not.throw();
|
||||
});
|
||||
|
||||
it('should not fail with valid week day name', () => {
|
||||
expect(() => {
|
||||
validate('* * * * Friday');
|
||||
}).to.not.throw();
|
||||
});
|
||||
|
||||
it('should not fail with * for week day', () => {
|
||||
expect(() => {
|
||||
validate('* * * * *');
|
||||
}).to.not.throw();
|
||||
});
|
||||
|
||||
it('should not fail with */2 for week day', () => {
|
||||
expect(() => {
|
||||
validate('* * * */2 *');
|
||||
}).to.not.throw();
|
||||
});
|
||||
|
||||
it('should not fail with Monday-Sunday for week day', () => {
|
||||
expect(() => {
|
||||
validate('* * * * Monday-Sunday');
|
||||
}).to.not.throw();
|
||||
});
|
||||
|
||||
it('should not fail with 1-7 for week day', () => {
|
||||
expect(() => {
|
||||
validate('0 0 1 1 1-7');
|
||||
}).to.not.throw();
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user