Skip to content

Commit

Permalink
fix: tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
divy9881 committed May 6, 2020
1 parent 58242a5 commit 4da5291
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/util/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function getEvalValue(s: string): string[] {
const subMatch: string[] = s.match(evalReg) as string[];
const rules: string[] = [];
for (const rule of subMatch) {
const index: number = rule.search('(');
const index: number = rule.indexOf('(');
rules.push(rule.slice(index + 1, -1));
}
return rules;
Expand Down
8 changes: 4 additions & 4 deletions test/util.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ test('test replaceEval', () => {
});

test('test getEvalValue', () => {
expect(util.getEvalValue('eval(a) && a && b && c')).isEqual(['a']);
expect(util.getEvalValue('a && eval(a) && b && c')).isEqual(['a']);
expect(util.getEvalValue('eval(a) && eval(b) && a && b && c')).isEqual(['a', 'b']);
expect(util.getEvalValue('a && eval(a) && eval(b) && b && c')).isEqual(['a', 'b']);
expect(util.arrayEquals(util.getEvalValue('eval(a) && a && b && c'), ['a']));
expect(util.arrayEquals(util.getEvalValue('a && eval(a) && b && c'), ['a']));
expect(util.arrayEquals(util.getEvalValue('eval(a) && eval(b) && a && b && c'), ['a', 'b']));
expect(util.arrayEquals(util.getEvalValue('a && eval(a) && eval(b) && b && c'), ['a', 'b']));
});

0 comments on commit 4da5291

Please sign in to comment.