You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					25 lines
				
				649 B
			
		
		
			
		
	
	
					25 lines
				
				649 B
			| 
								 
											2 years ago
										 
									 | 
							
								'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!');
							 | 
						||
| 
								 | 
							
								    });
							 | 
						||
| 
								 | 
							
								});
							 |