Skip to content

Commit f3c8cd6

Browse files
committed
refactor: Rename testCaseState to snapshot in getDecorations
1 parent 384a055 commit f3c8cd6

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

packages/test-case-component/src/generateHtml.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function createHtmlGenerator(data: DataFixture) {
5959
console.error(`Error in ${stepName} ${raw.command.spokenForm}`);
6060
return "Error";
6161
}
62-
const decorations = await getDecorations(state, command);
62+
const decorations = await getDecorations({ snapshot: state, command });
6363
const { documentContents } = state;
6464
const htmlArray: string[] = [];
6565
let codeBody;

packages/test-case-component/src/helpers/decorations/getDecorations.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,24 @@ import type { Command } from "@cursorless/common";
1010
import type { DecorationItem } from "shiki";
1111
import { createDecorations } from "../index";
1212

13-
export async function getDecorations(
14-
testCaseState: ExtendedTestCaseSnapshot,
15-
command: Command
16-
): Promise<DecorationItem[][]> {
17-
const { messages, flashes, highlights, finalStateMarkHelpers } = testCaseState;
18-
const potentialMarks = testCaseState.marks || {};
19-
const lines = testCaseState.documentContents.split("\n");
13+
export async function getDecorations({
14+
snapshot,
15+
command
16+
}: {
17+
snapshot: ExtendedTestCaseSnapshot;
18+
command: Command;
19+
}): Promise<DecorationItem[][]> {
20+
const { messages, flashes, highlights, finalStateMarkHelpers } = snapshot;
21+
const potentialMarks = snapshot.marks || {};
22+
const lines = snapshot.documentContents.split("\n");
2023
const obj = {
2124
marks: potentialMarks,
2225
ide: { messages, flashes, highlights },
2326
command,
2427
lines,
25-
selections: testCaseState.selections,
26-
thatMark: testCaseState.thatMark,
27-
sourceMark: testCaseState.sourceMark,
28+
selections: snapshot.selections,
29+
thatMark: snapshot.thatMark,
30+
sourceMark: snapshot.sourceMark,
2831
finalStateMarkHelpers
2932
};
3033
const decorations = createDecorations(obj);

0 commit comments

Comments
 (0)