Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
ZimGil committed May 18, 2020
1 parent d740612 commit c081925
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/convert-expression/step-values-conversion.js
Expand Up @@ -9,7 +9,7 @@ module.exports = (() => {
if(isStepValue){
var baseDivider = match[2];
if(isNaN(baseDivider)){
throw baseDivider + 'is not a valid step value';
throw baseDivider + ' is not a valid step value';
}
var values = match[1].split(',');
var setpValues = [];
Expand Down
8 changes: 7 additions & 1 deletion test/convert-expression/step-values-conversion-test.js
Expand Up @@ -4,10 +4,16 @@ const { expect } = require('chai');
var conversion = require('../../src/convert-expression/step-values-conversion');

describe('step-values-conversion.js', () => {
it('shuld convert step values', () => {
it('should convert step values', () => {
var expressions = '1,2,3,4,5,6,7,8,9,10/2 0,1,2,3,4,5,6,7,8,9/5 * * * *'.split(' ');
expressions = conversion(expressions);
expect(expressions[0]).to.equal('2,4,6,8,10');
expect(expressions[1]).to.equal('0,5');
});

it('should throw an error if step value is not a number', () => {
var expressions = '1,2,3,4,5,6,7,8,9,10/someString 0,1,2,3,4,5,6,7,8,9/5 * * * *'.split(' ');
expect(() => conversion(expressions)).to.throw('someString is not a valid step value');
});

});

0 comments on commit c081925

Please sign in to comment.