Skip to content

Commit 1e1fca7

Browse files
Merge pull request #198 from UmiKami/141-multiply
fixed test to fail on * operator usage
2 parents cc10a98 + 42954a2 commit 1e1fca7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

exercises/141-multiply/test.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const fs = require('fs');
2+
const path = require('path');
13
const rewire = require('rewire');
24
const multiply = rewire('./app.js').__get__('multiply');
35

@@ -30,6 +32,7 @@ test('Given 2 integer numbers, multiply and return the total. Testing with diffe
3032
});
3133

3234
test('Must not use the * operator', () => {
33-
let multiplyOperator = '*';
34-
expect(multiplyOperator).not.toBe(multiply);
35+
const file = fs.readFileSync(path.resolve(__dirname, './app.js'), 'utf8');
36+
const regex = /\s*\*\s*/gm
37+
expect(regex.test(file.toString())).toBeFalsy();
3538
});

0 commit comments

Comments
 (0)