chore: include e2e folder in lint:ts (#55325)

Co-authored-by: sembauke <semboot699@gmail.com>
Co-authored-by: Naomi the Technomancer <accounts+github@nhcarrigan.com>
This commit is contained in:
Huyen Nguyen
2024-07-05 20:56:17 -07:00
committed by GitHub
parent fbf28bbb4c
commit 2172e7bd28
4 changed files with 25 additions and 3 deletions

View File

@@ -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;

View File

@@ -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) {

View File

@@ -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('/');
});
@@ -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');

View File

@@ -1,6 +1,7 @@
{
"include": [
"curriculum/*.test.ts",
"e2e/**/*.ts",
"tools/challenge-auditor/index.ts",
"tools/challenge-editor/**/*",
"tools/challenge-helper-scripts/**/*.ts",