mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-02-26 08:03:56 -05:00
fix(curriculum): Make calculator tests less restrictive (#60188)
This commit is contained in:
@@ -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--
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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`.
|
||||
|
||||
@@ -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`.
|
||||
|
||||
Reference in New Issue
Block a user