## Changes made - Copied over all changes to existing modules, making sure to preserve all relative path updates made specifically for the Registry repo - Copied over all modules that were created since the last sync (Windsurf, Devcontainers-CLI) - Copied over changes from the `test.ts` file ## Notes - This PR does not cover https://github.com/coder/modules/pull/426, which contains a few changes around updating the Bash scripts and the contributing README file. @f0ssel tagging you so that you're aware, but I'll be taking care of the `CONTRIBUTING.md` file --------- Co-authored-by: M Atif Ali <me@matifali.dev>
89 lines
2.8 KiB
TypeScript
89 lines
2.8 KiB
TypeScript
import { describe, expect, it } from "bun:test";
|
|
import {
|
|
runTerraformApply,
|
|
runTerraformInit,
|
|
testRequiredVariables,
|
|
} from "~test";
|
|
|
|
describe("windsurf", async () => {
|
|
await runTerraformInit(import.meta.dir);
|
|
|
|
testRequiredVariables(import.meta.dir, {
|
|
agent_id: "foo",
|
|
});
|
|
|
|
it("default output", async () => {
|
|
const state = await runTerraformApply(import.meta.dir, {
|
|
agent_id: "foo",
|
|
});
|
|
expect(state.outputs.windsurf_url.value).toBe(
|
|
"windsurf://coder.coder-remote/open?owner=default&workspace=default&url=https://mydeployment.coder.com&token=$SESSION_TOKEN",
|
|
);
|
|
|
|
const coder_app = state.resources.find(
|
|
(res) => res.type === "coder_app" && res.name === "windsurf",
|
|
);
|
|
|
|
expect(coder_app).not.toBeNull();
|
|
expect(coder_app?.instances.length).toBe(1);
|
|
expect(coder_app?.instances[0].attributes.order).toBeNull();
|
|
});
|
|
|
|
it("adds folder", async () => {
|
|
const state = await runTerraformApply(import.meta.dir, {
|
|
agent_id: "foo",
|
|
folder: "/foo/bar",
|
|
});
|
|
expect(state.outputs.windsurf_url.value).toBe(
|
|
"windsurf://coder.coder-remote/open?owner=default&workspace=default&folder=/foo/bar&url=https://mydeployment.coder.com&token=$SESSION_TOKEN",
|
|
);
|
|
});
|
|
|
|
it("adds folder and open_recent", async () => {
|
|
const state = await runTerraformApply(import.meta.dir, {
|
|
agent_id: "foo",
|
|
folder: "/foo/bar",
|
|
open_recent: true,
|
|
});
|
|
expect(state.outputs.windsurf_url.value).toBe(
|
|
"windsurf://coder.coder-remote/open?owner=default&workspace=default&folder=/foo/bar&openRecent&url=https://mydeployment.coder.com&token=$SESSION_TOKEN",
|
|
);
|
|
});
|
|
|
|
it("adds folder but not open_recent", async () => {
|
|
const state = await runTerraformApply(import.meta.dir, {
|
|
agent_id: "foo",
|
|
folder: "/foo/bar",
|
|
open_recent: false,
|
|
});
|
|
expect(state.outputs.windsurf_url.value).toBe(
|
|
"windsurf://coder.coder-remote/open?owner=default&workspace=default&folder=/foo/bar&url=https://mydeployment.coder.com&token=$SESSION_TOKEN",
|
|
);
|
|
});
|
|
|
|
it("adds open_recent", async () => {
|
|
const state = await runTerraformApply(import.meta.dir, {
|
|
agent_id: "foo",
|
|
open_recent: true,
|
|
});
|
|
expect(state.outputs.windsurf_url.value).toBe(
|
|
"windsurf://coder.coder-remote/open?owner=default&workspace=default&openRecent&url=https://mydeployment.coder.com&token=$SESSION_TOKEN",
|
|
);
|
|
});
|
|
|
|
it("expect order to be set", async () => {
|
|
const state = await runTerraformApply(import.meta.dir, {
|
|
agent_id: "foo",
|
|
order: 22,
|
|
});
|
|
|
|
const coder_app = state.resources.find(
|
|
(res) => res.type === "coder_app" && res.name === "windsurf",
|
|
);
|
|
|
|
expect(coder_app).not.toBeNull();
|
|
expect(coder_app?.instances.length).toBe(1);
|
|
expect(coder_app?.instances[0].attributes.order).toBe(22);
|
|
});
|
|
});
|