fix(learn): Convert response testcase regex handles any variable name (#40568)
* Update convert response to JSON testcase Testcase previously required that variable be named exactly "response". Changes will allow variable of any name to be used. Example: res can now be used and tests still pass. * Forgot the \ in front of )
This commit is contained in:
@ -49,7 +49,7 @@ Your code should use `then` to convert the response to JSON.
|
|||||||
```js
|
```js
|
||||||
assert(
|
assert(
|
||||||
code.match(
|
code.match(
|
||||||
/\.then\s*\(\s*(response|\(\s*response\s*\))\s*=>\s*response\s*\.json\s*\(\s*\)\s*\)/g
|
/\.then\s*\(\s*\(?(?<var>\w+)\)?\s*=>\s*\k<var>\s*\.json\s*\(\s*\)\s*\)/g
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
Reference in New Issue
Block a user