chore: format test file

This commit is contained in:
Aly Thobani 2026-05-11 17:29:39 -07:00
parent fdc3aa054e
commit b46f370b37

View file

@ -1,67 +1,39 @@
import { describe, expect, test } from "vitest";
import {
jumpToNextCodeFence,
jumpToPreviousCodeFence,
} from "../motions/jumpToCodeFence";
import { jumpToNextCodeFence, jumpToPreviousCodeFence } from "../motions/jumpToCodeFence";
import { createFakeCodeMirrorEditor } from "./createFakeCodeMirrorEditor";
const CODE_FENCE_CONTENT_LINES = [
"intro",
"```ts",
"const answer = 42;",
"```",
"outro",
];
const CODE_FENCE_CONTENT_LINES = ["intro", "```ts", "const answer = 42;", "```", "outro"];
describe("jumpToNextCodeFence", () => {
test("jumps to the next opening code fence", () => {
expectNextCodeFencePosition(
{ line: 0, ch: 0 },
{ line: 1, ch: 0 }
);
expectNextCodeFencePosition({ line: 0, ch: 0 }, { line: 1, ch: 0 });
});
test("jumps to the next closing code fence", () => {
expectNextCodeFencePosition(
{ line: 2, ch: 0 },
{ line: 3, ch: 0 }
);
expectNextCodeFencePosition({ line: 2, ch: 0 }, { line: 3, ch: 0 });
});
test("wraps to the first code fence after the last one", () => {
expectNextCodeFencePosition(
{ line: 4, ch: 0 },
{ line: 1, ch: 0 }
);
expectNextCodeFencePosition({ line: 4, ch: 0 }, { line: 1, ch: 0 });
});
test("ignores backticks that are not code fence lines", () => {
expectNextCodeFencePosition(
{ line: 0, ch: 0 },
{ line: 1, ch: 0 },
[
"here are inline backticks ``` not a fence",
"```ts",
"const answer = 42;",
"```",
]
);
expectNextCodeFencePosition({ line: 0, ch: 0 }, { line: 1, ch: 0 }, [
"here are inline backticks ``` not a fence",
"```ts",
"const answer = 42;",
"```",
]);
});
});
describe("jumpToPreviousCodeFence", () => {
test("jumps to the previous closing code fence", () => {
expectPreviousCodeFencePosition(
{ line: 4, ch: 0 },
{ line: 3, ch: 0 }
);
expectPreviousCodeFencePosition({ line: 4, ch: 0 }, { line: 3, ch: 0 });
});
test("jumps to the previous opening code fence", () => {
expectPreviousCodeFencePosition(
{ line: 2, ch: 0 },
{ line: 1, ch: 0 }
);
expectPreviousCodeFencePosition({ line: 2, ch: 0 }, { line: 1, ch: 0 });
});
});