gram/packages/vscode-extension/tests/client-options.test.ts
abiwab efc38df400
All checks were successful
CI / Build, Test & Publish (pull_request) Successful in 4m24s
refactor: rename the work plan view to run sheet (plan de marche in French)
2026-11-06 20:33:43 +01:00

35 lines
1.1 KiB
TypeScript

import { describe, expect, it } from "bun:test";
import { readFileSync } from "node:fs";
import { join } from "node:path";
import {
CONFIGURATION_SECTION,
createClientOptions,
} from "../src/client-options";
describe("language client options", () => {
it("tells the server when a gram.* setting changes", () => {
// Without `synchronize.configurationSection` the client never sends
// workspace/didChangeConfiguration, so changing gram.miseEnPlace in the
// settings left the preview and the run sheet untouched.
expect(createClientOptions().synchronize?.configurationSection).toBe(
"gram",
);
});
it("uses the same section the settings are declared under", () => {
const manifest = JSON.parse(
readFileSync(join(import.meta.dir, "..", "package.json"), "utf-8"),
);
const keys = Object.keys(manifest.contributes.configuration.properties);
expect(keys.length).toBeGreaterThan(0);
for (const key of keys) {
expect(key.startsWith(`${CONFIGURATION_SECTION}.`)).toBe(true);
}
});
it("still selects gram files", () => {
expect(createClientOptions().documentSelector).toEqual([
{ scheme: "file", language: "gram" },
]);
});
});