fix(curriculum): Make calculator tests less restrictive (#60188)

This commit is contained in:
c0d1ng_ma5ter
2025-05-06 15:51:38 -06:00
committed by GitHub
parent ff43f3aeca
commit 32c19f1b92
6 changed files with 12 additions and 6 deletions

View File

@@ -33,7 +33,8 @@ assert.isFunction(calculateSum);
Your `calculateSum` function should take two parameters, `num1` and `num2`.
```js
assert.match(code, /calculateSum\s*(?:=\s*)?\(\s*num1\s*,\s*num2\s*\)\s*/);
const regex = __helpers.functionRegex('calculateSum', ['num1', 'num2']);
assert.match(__helpers.removeJSComments(code), regex);
```
# --seed--

View File

@@ -24,7 +24,8 @@ assert.isFunction(calculateDifference);
Your `calculateDifference` function should have two parameters called `num1` and `num2`.
```js
assert.match(code, /calculateDifference\s*(?:=\s*)?\(\s*num1\s*,\s*num2\s*\)\s*/);
const regex = __helpers.functionRegex('calculateDifference', ['num1', 'num2']);
assert.match(__helpers.removeJSComments(code), regex);
```
Your `calculateDifference` function should return the difference between the two parameters.

View File

@@ -26,7 +26,8 @@ assert.isFunction(calculateProduct);
Your `calculateProduct` function should have two parameters called `num1` and `num2`.
```js
assert.match(code, /calculateProduct\s*(?:=\s*)?\(\s*num1\s*,\s*num2\s*\)\s*/);
const regex = __helpers.functionRegex('calculateProduct', ['num1', 'num2']);
assert.match(__helpers.removeJSComments(code), regex);
```
Your `calculateProduct` function should return the product of the two parameters.

View File

@@ -26,7 +26,8 @@ assert.isFunction(calculateQuotient);
Your `calculateQuotient` function should have two parameters called `num1` and `num2`.
```js
assert.match(code, /calculateQuotient\s*(?:=\s*)?\(\s*num1\s*,\s*num2\s*\)\s*/);
const regex = __helpers.functionRegex('calculateQuotient', ['num1', 'num2']);
assert.match(__helpers.removeJSComments(code), regex);
```
Your `calculateQuotient` function should return the quotient of the two parameters.

View File

@@ -37,7 +37,8 @@ assert.isFunction(calculateSquare);
Your `calculateSquare` function should take a `num` parameter.
```js
assert.match(code, /calculateSquare\s*(?:=\s*)?\(\s*num\s*\)/);
const regex = __helpers.functionRegex('calculateSquare', ['num']);
assert.match(__helpers.removeJSComments(code), regex);
```
Your `calculateSquare` function should return the square of `num`.

View File

@@ -35,7 +35,8 @@ assert.isFunction(calculateSquareRoot);
Your `calculateSquareRoot` function should take a `num` parameter.
```js
assert.match(code, /calculateSquareRoot\s*(?:=\s*)?\(\s*num\s*\)/);
const regex = __helpers.functionRegex('calculateSquareRoot', ['num']);
assert.match(__helpers.removeJSComments(code), regex);
```
Your `calculateSquareRoot` function should return the square root of `num`.