mirror of
https://github.com/morluto/rea.git
synced 2026-12-04 05:51:06 +00:00
test(javascript): share CLI and MCP session app fixtures (#16368)
* test(javascript): share CLI and MCP session app fixtures * test(mcp): remove unused session fixture import
This commit is contained in:
1 parent
efa6e16286
commit
b352b301c7
3 files changed
+22
-29
No files matched your search
@@ -1,6 +1,5 @@
|
||||
import { expect, test } from "vitest";
|
||||
|
||||
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
||||
import {
|
||||
cliTest,
|
||||
createSharedMcpSession,
|
||||
@@ -10,8 +9,8 @@ import {
|
||||
import {
|
||||
analyzeJavaScriptDirectory,
|
||||
resolveJavaScriptApplicationMcpCall,
|
||||
writeSessionApp,
|
||||
} from "../../support/cli/javascriptApplication.js";
|
||||
import { writeFixtureFiles } from "../../support/workspace/writeFixtureFiles.js";
|
||||
|
||||
const unusedCli = {
|
||||
run: async () => {
|
||||
@@ -50,17 +49,6 @@ test("uses the file session when the case does not own a server", async () => {
|
||||
expect(resolved).toBe(shared);
|
||||
});
|
||||
|
||||
const writeApplication = async (prefix: string): Promise<string> => {
|
||||
const root = await createTestTempDirectory(prefix);
|
||||
await writeFixtureFiles(root, {
|
||||
"package.json": JSON.stringify({ main: "main.cjs" }),
|
||||
"main.cjs":
|
||||
'const { BrowserWindow } = require("electron"); new BrowserWindow().loadFile("index.html");',
|
||||
"index.html": "page",
|
||||
});
|
||||
return root;
|
||||
};
|
||||
|
||||
let fileSession: SharedMcpCall | undefined;
|
||||
|
||||
/** Record the first selected case and compare later cases when they also run. */
|
||||
@@ -266,7 +254,7 @@ cliTest(
|
||||
async ({ cli }) => {
|
||||
const first = await useFileSession(cli);
|
||||
expect(await useFileSession(cli)).toBe(first);
|
||||
const root = await writeApplication("rea-shared-mcp-");
|
||||
const root = await writeSessionApp("rea-shared-mcp-");
|
||||
const analyzed = await analyzeJavaScriptDirectory("stdio MCP", cli, root);
|
||||
expect(
|
||||
analyzed.graph.nodes.some(({ kind }) => kind === "electron-renderer"),
|
||||
@@ -278,7 +266,7 @@ cliTest(
|
||||
"reuses that stdio MCP session for a later case in the file",
|
||||
async ({ cli }) => {
|
||||
await useFileSession(cli);
|
||||
const root = await writeApplication("rea-shared-mcp-later-");
|
||||
const root = await writeSessionApp("rea-shared-mcp-later-");
|
||||
const analyzed = await analyzeJavaScriptDirectory("stdio MCP", cli, root);
|
||||
expect(
|
||||
analyzed.graph.nodes.some(({ kind }) => kind === "electron-renderer"),
|
||||
|
||||
Reference in new issue
Block a user