|
1 |
| -import { describe, expect, it } from "bun:test"; |
| 1 | +import { describe, it, expect } from "bun:test"; |
2 | 2 | import {
|
3 | 3 | runTerraformApply,
|
4 | 4 | runTerraformInit,
|
5 | 5 | testRequiredVariables,
|
| 6 | + runContainer, |
| 7 | + execContainer, |
| 8 | + removeContainer, |
| 9 | + findResourceInstance, |
| 10 | + readFileContainer, |
6 | 11 | } from "~test";
|
7 | 12 |
|
8 | 13 | describe("cursor", async () => {
|
@@ -85,4 +90,26 @@ describe("cursor", async () => {
|
85 | 90 | expect(coder_app?.instances.length).toBe(1);
|
86 | 91 | expect(coder_app?.instances[0].attributes.order).toBe(22);
|
87 | 92 | });
|
| 93 | + |
| 94 | + it("writes ~/.cursor/mcp.json when mcp provided", async () => { |
| 95 | + const id = await runContainer("alpine"); |
| 96 | + try { |
| 97 | + const mcp = JSON.stringify({ servers: { demo: { url: "http://localhost:1234" } } }); |
| 98 | + const state = await runTerraformApply(import.meta.dir, { |
| 99 | + agent_id: "foo", |
| 100 | + mcp, |
| 101 | + }); |
| 102 | + const script = findResourceInstance(state, "coder_script", "cursor_mcp").script; |
| 103 | + const resp = await execContainer(id, ["sh", "-c", script]); |
| 104 | + if (resp.exitCode !== 0) { |
| 105 | + console.log(resp.stdout); |
| 106 | + console.log(resp.stderr); |
| 107 | + } |
| 108 | + expect(resp.exitCode).toBe(0); |
| 109 | + const content = await readFileContainer(id, "/root/.cursor/mcp.json"); |
| 110 | + expect(content).toBe(mcp); |
| 111 | + } finally { |
| 112 | + await removeContainer(id); |
| 113 | + } |
| 114 | + }); |
88 | 115 | });
|
0 commit comments