mirror of
https://github.com/morluto/rea.git
synced 2026-12-05 06:21:12 +00:00
test: share unrelated TOML value assertions (#16928)
This commit is contained in:
1 parent
fc9946838e
commit
2ee94d4a18
3 files changed
+14
-21
No files matched your search
@@ -4,6 +4,7 @@ import { parse as parseToml } from "smol-toml";
|
||||
import { expect } from "vitest";
|
||||
|
||||
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
||||
import { unrelatedValues } from "../../fixtures/unrelatedTomlValues.js";
|
||||
import { cliTest } from "../../support/cli/cliFixture.js";
|
||||
|
||||
const scenarios = [
|
||||
@@ -60,17 +61,6 @@ const scenarios = [
|
||||
},
|
||||
] as const;
|
||||
|
||||
/** Read unrelated values independently of the installed launcher's spelling. */
|
||||
const unrelatedValues = (text: string) => {
|
||||
const document = parseToml(text);
|
||||
const servers = document.mcp_servers;
|
||||
if (typeof servers === "object" && servers !== null) {
|
||||
Reflect.deleteProperty(servers, "rea");
|
||||
if (Object.keys(servers).length === 0) delete document.mcp_servers;
|
||||
}
|
||||
return document;
|
||||
};
|
||||
|
||||
cliTest(
|
||||
"TOML setup and uninstall keep comments around middle and final registrations",
|
||||
async ({ cli }) => {
|
||||
|
||||
@@ -15,6 +15,7 @@ import { dirname, join } from "node:path";
|
||||
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { parse as parseToml } from "smol-toml";
|
||||
import { unrelatedValues } from "../../fixtures/unrelatedTomlValues.js";
|
||||
|
||||
import {
|
||||
configureClientConfiguration,
|
||||
@@ -453,16 +454,6 @@ const unrelatedServer = [
|
||||
"",
|
||||
].join("\n");
|
||||
|
||||
const unrelatedValues = (text: string) => {
|
||||
const document = parseToml(text);
|
||||
const servers = document.mcp_servers;
|
||||
if (typeof servers === "object" && servers !== null) {
|
||||
Reflect.deleteProperty(servers, "rea");
|
||||
if (Object.keys(servers).length === 0) delete document.mcp_servers;
|
||||
}
|
||||
return document;
|
||||
};
|
||||
|
||||
describe("Codex configuration text preservation", () => {
|
||||
it.each([
|
||||
{
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
import { parse as parseToml } from "smol-toml";
|
||||
|
||||
/** Read unrelated values independently of the installed launcher's spelling. */
|
||||
export const unrelatedValues = (text: string) => {
|
||||
const document = parseToml(text);
|
||||
const servers = document.mcp_servers;
|
||||
if (typeof servers === "object" && servers !== null) {
|
||||
Reflect.deleteProperty(servers, "rea");
|
||||
if (Object.keys(servers).length === 0) delete document.mcp_servers;
|
||||
}
|
||||
return document;
|
||||
};
|
||||
Reference in new issue
Block a user