Skip to content

Commit 4a29f23

Browse files
authored
feat(curriculum): add test number enumeration (freeCodeCamp#55874)
1 parent 786a49d commit 4a29f23

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

client/src/templates/Challenges/components/test-suite.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function TestSuite({ tests }: TestSuiteProps): JSX.Element {
4343
pass && !err ? t('icons.passed') : t('icons.failed');
4444
// Remove opening/closing <p> so screen reader will read both
4545
// status message and test text as one block.
46-
text = text.replace(/^<p>|<\/p>$/g, '');
46+
text = `${index + 1}. ${text.replace(/^<p>|<\/p>$/g, '')}`;
4747
return (
4848
<li
4949
className='test-result'

client/src/templates/Challenges/redux/execute-challenge-saga.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ function* executeTests(testRunner, tests, testTimeout = 5000) {
232232
newTest.stack = stack;
233233
}
234234

235+
newTest.message = newTest.message.replace(/<p>/, `<p>${i + 1}. `);
235236
yield put(updateConsole(newTest.message));
236237
} finally {
237238
testResults.push(newTest);

e2e/output.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const outputTexts = {
1313
> 1 | var
1414
| ^`,
1515
empty: `// running tests
16-
You should declare myName with the var keyword, ending with a semicolon
16+
1. You should declare myName with the var keyword, ending with a semicolon
1717
// tests completed`,
1818
passed: `// running tests
1919
// tests completed`

e2e/test-suite.spec.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,15 @@ test.describe('Challenge Test Suite Component Tests', () => {
2525
await expect(page.getByTestId('test-result')).toHaveCount(3);
2626
await expect(page.getByText(translations.icons.initial)).toHaveCount(3);
2727
await expect(
28-
page.getByText('You should not change code above the specified comment.')
28+
page.getByText(
29+
'1. You should not change code above the specified comment.'
30+
)
2931
).toBeVisible();
30-
await expect(page.getByText('b should have a value of 7.')).toBeVisible();
3132
await expect(
32-
page.getByText('a should be assigned to b with =.')
33+
page.getByText('2. b should have a value of 7.')
34+
).toBeVisible();
35+
await expect(
36+
page.getByText('3. a should be assigned to b with =.')
3337
).toBeVisible();
3438
});
3539

0 commit comments

Comments
 (0)