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:
Durbatuluk1701 2021-01-21 10:54:24 -06:00 committed by GitHub
parent 8a9f3319c6
commit 0a7aa59d51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,7 +49,7 @@ Your code should use `then` to convert the response to JSON.
```js
assert(
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
)
);
```