Skip to content

Commit

Permalink
chore: include e2e folder in lint:ts (freeCodeCamp#55325)
Browse files Browse the repository at this point in the history
Co-authored-by: sembauke <[email protected]>
Co-authored-by: Naomi the Technomancer <[email protected]>
  • Loading branch information
3 people authored Jul 6, 2024
1 parent fbf28bb commit 2172e7b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion client/src/components/seo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const SEO: React.FC<SEOProps> = ({ title, children }) => {
const superBlockIntroObj: {
title: string;
intro: string[];
} = t(`intro:${superBlock}`);
} = t(`intro:${superBlock}`, { returnObjects: true });

const { title: i18nTitle, intro: introText } = superBlockIntroObj;

Expand Down
17 changes: 16 additions & 1 deletion e2e/mobile/mobile-learn.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,22 @@ const publicSB = orderedSuperBlockInfo
.filter(sb => sb.public === true && !nonEditorSB.includes(sb.dashedName))
.map(sb => sb.dashedName);

const typedCurriculum = currData as Curriculum;
const incompatible = [
'certifications',
'a2-english-for-developers',
'b1-english-for-developers'
];

const removeNonCompatibleSuperblocks = (currData: Curriculum): Curriculum => {
const copy = currData;

for (const superBlock of incompatible) {
delete copy[superBlock];
}
return copy;
};

const typedCurriculum = removeNonCompatibleSuperblocks(currData as never);

test.describe('Test challenges in mobile', () => {
for (const superBlock of publicSB) {
Expand Down
8 changes: 7 additions & 1 deletion e2e/seo.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ import { SuperBlocks } from '../shared/config/superblocks';
import type { ListItem } from '../client/src/components/seo/';
import metaTags from '../client/i18n/locales/english/meta-tags.json';

interface StructuredData {
'@context': string;
'@type': string;
itemListElement: ListItem[];
}

test.beforeEach(async ({ page }) => {
await page.goto('/');
});
Expand All @@ -20,7 +26,7 @@ test('should inject structured data (JSON-LD) into the page', async ({

expect(structuredData).toBeTruthy();

const parsedData = JSON.parse(structuredData ?? '');
const parsedData = JSON.parse(structuredData ?? '') as StructuredData;

expect(parsedData?.['@context']).toBe('https://schema.org');
expect(parsedData['@type']).toBe('ItemList');
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"include": [
"curriculum/*.test.ts",
"e2e/**/*.ts",
"tools/challenge-auditor/index.ts",
"tools/challenge-editor/**/*",
"tools/challenge-helper-scripts/**/*.ts",
Expand Down

0 comments on commit 2172e7b

Please sign in to comment.