Fix: Running Test with a comment fails test on Understand The immediately invoked function expression iife (#39347)

* Update Regex to test if it's an IIFE instead of checking for a parenthases at the end.

* Second Test will now pass the test

* Escape One Parenthese

* Update Regex to be more structured

Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>

* Missing regex ending literal

Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>
This commit is contained in:
Joshua Pelealu
2020-09-01 19:48:32 -04:00
committed by GitHub
parent e7718e5c3f
commit a050de56bb

View File

@ -33,7 +33,7 @@ tests:
- text: The function should be anonymous.
testString: assert(/\((function|\(\))(=>|\(\)){?/.test(code.replace(/\s/g, "")));
- text: Your function should have parentheses at the end of the expression to call it immediately.
testString: assert(/}?\)\(\)$|}\(\)\)$/.test(code.replace(/[\s;]/g, "")));
testString: assert(/\(.*(\)\(|\}\(\))\)/.test(code.replace(/[\s;]/g, "")));
```