Skip to content

Commit c56ec76

Browse files
committed
refactor: Use test case example folder in component-sheet
1 parent 9fa757a commit c56ec76

File tree

1 file changed

+12
-30
lines changed

1 file changed

+12
-30
lines changed

packages/cursorless-org/src/pages/component-sheet.tsx

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { testSelectedFiles } from "./allowList";
1010

1111
import { cheatsheetBodyClasses } from "@cursorless/cheatsheet";
1212

13-
const fixturesDir = path.join("../", "../", "data", "fixtures", "recorded");
13+
const fixturesDir = path.join("../", "../", "data", "example-files");
1414

1515
async function loadYamlFiles(dir: string, selectedFiles?: string[]) {
1616
const directoryPath = path.join(process.cwd(), dir);
@@ -39,40 +39,22 @@ async function loadYamlFiles(dir: string, selectedFiles?: string[]) {
3939

4040
// See https://github.com/vercel/next.js/discussions/12325#discussioncomment-1116108
4141
export async function getStaticProps() {
42-
const itemsDirActions = path.join(fixturesDir, "actions");
43-
const itemsDirDecorations = path.join(fixturesDir, "decorations");
44-
const itemsDirInsertEmptyLines = path.join(
45-
fixturesDir,
46-
"actions/insertEmptyLines",
47-
);
48-
49-
const dataActions = await loadYamlFiles(itemsDirActions, testSelectedFiles);
50-
const dataInsertEmptyLines = await loadYamlFiles(
51-
itemsDirInsertEmptyLines,
52-
testSelectedFiles,
53-
);
54-
55-
const dataDecorations = await loadYamlFiles(
56-
itemsDirDecorations,
57-
testSelectedFiles,
58-
);
42+
const dataActions = await loadYamlFiles(fixturesDir, testSelectedFiles);
5943

6044
const data_errors: any[] = [];
6145

6246
const data = (
6347
await Promise.all(
64-
[...dataActions, ...dataDecorations, ...dataInsertEmptyLines].map(
65-
async (val) => {
66-
try {
67-
const fixture = await loadTestCaseFixture(val);
68-
return { ...fixture, raw: val };
69-
} catch (err) {
70-
console.error(err);
71-
data_errors.push(val);
72-
return null;
73-
}
74-
},
75-
),
48+
[...dataActions].map(async (val) => {
49+
try {
50+
const fixture = await loadTestCaseFixture(val);
51+
return { ...fixture, raw: val };
52+
} catch (err) {
53+
console.error(err);
54+
data_errors.push(val);
55+
return null;
56+
}
57+
}),
7658
)
7759
).filter((test) => test !== undefined);
7860

0 commit comments

Comments
 (0)