mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(curriculum): improve test for profile card step 4 (#61992)
This commit is contained in:
+9
-6
@@ -19,14 +19,17 @@ You should export an `App` functional component.
|
||||
assert.isFunction(window.index.App);
|
||||
```
|
||||
|
||||
Your `App` component should return an empty string.
|
||||
Your `App` component should return a pair of parentheses with an empty string inside.
|
||||
|
||||
```js
|
||||
// This isn't a perfect test, since various return values are converted into
|
||||
// empty strings, but it has to be a valid React component.
|
||||
async() => {
|
||||
const testElem = await __helpers.prepTestComponent(window.index.App);
|
||||
assert.equal(testElem.textContent, '');
|
||||
async () => {
|
||||
const functionRegex = __helpers.functionRegex("App", null, { capture: true });
|
||||
const match = code.match(functionRegex);
|
||||
const functionDefinition = match[0];
|
||||
assert.match(
|
||||
functionDefinition,
|
||||
/\s*{\s*return\s*\(\s*(''|""|``)\s*\)\s*;?\s*}|\s*=>\s*\(\s*(''|""|``)\s*\)/
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user