Fix tests failing due to whitespaces and trailing forward slash in Advanced Node and Express (#39534)

* Fix implementation-of-social-authentication.english.md

Resolve #39533

* Update implementation-of-social-authentication.english.md

- added capture groups
- updated whitespace filter, `/[\s\r\n]/g` -> `/\s/g`

* Update curriculum/challenges/english/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication.english.md

Co-authored-by: Shaun Hamilton <51722130+Sky020@users.noreply.github.com>

* Update implementation-of-social-authentication.english.md

Co-authored-by: Shaun Hamilton <51722130+Sky020@users.noreply.github.com>
This commit is contained in:
piouson
2020-09-08 17:55:20 +01:00
committed by GitHub
parent ff8db8ce9e
commit fbbf7e3f75

View File

@ -40,9 +40,9 @@ Submit your page when you think you've got it right. If you're running into erro
```yml
tests:
- text: Route /auth/github should be correct.
testString: getUserInput => $.get(getUserInput('url')+ '/_api/routes.js') .then(data => { assert.match(data, /('|")\/auth\/github('|")[^]*get.*passport.authenticate.*github/gi, 'Route auth/github should only call passport.authenticate with github'); }, xhr => { throw new Error(xhr.statusText); })
testString: getUserInput => $.get(getUserInput('url')+ '/_api/routes.js') .then(data => { assert.match(data.replace(/\s/g,""), /('|")\/auth\/github\/?\1[^]*?get.*?passport.authenticate.*?github/gi, 'Route auth/github should only call passport.authenticate with github'); }, xhr => { throw new Error(xhr.statusText); })
- text: Route /auth/github/callback should be correct.
testString: getUserInput => $.get(getUserInput('url')+ '/_api/routes.js') .then(data => { assert.match(data, /('|")\/auth\/github\/callback('|")[^]*get.*passport.authenticate.*github.*failureRedirect:( |)("|')\/\2/gi, 'Route auth/github/callback should accept a get request and call passport.authenticate for github with a failure redirect to home'); }, xhr => { throw new Error(xhr.statusText); })
testString: getUserInput => $.get(getUserInput('url')+ '/_api/routes.js') .then(data => { assert.match(data.replace(/\s/g,""), /('|")\/auth\/github\/callback\/?\1[^]*?get.*?passport.authenticate.*?github.*?failureRedirect:("|')\/\2/gi, 'Route auth/github/callback should accept a get request and call passport.authenticate for github with a failure redirect to home'); }, xhr => { throw new Error(xhr.statusText); })
```