Add unit tests for isSubstringInArray utility function

This commit is contained in:
Joshua Colvin
2017-01-07 12:57:32 -05:00
parent 9b66b114cc
commit ff0ab048df

View File

@@ -202,3 +202,15 @@ describe('when cloning CSS ', function () {
});
});
describe('when finding substring in array ', function () {
it('should return the array index that contains the substring', function () {
var arr = ['stroke:val1', 'fill:val2'];
var result = utils.isSubstringInArray('fill', arr);
expect(result).toEqual(1);
});
it('should return -1 if the substring is not found in the array', function () {
var arr = ['stroke:val1', 'stroke-width:val2'];
var result = utils.isSubstringInArray('fill', arr);
expect(result).toEqual(-1);
});
});