fix(curriculum): improve test for profile card step 4 (#61992)

This commit is contained in:
Ezoh Zhang
2025-09-05 18:36:13 +01:00
committed by GitHub
parent 34014f1099
commit 3b6ce9c545
@@ -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*\)/
);
}
```