Add basic test

This commit is contained in:
Koury Lape 2026-01-29 14:18:03 -05:00
parent 252d08ccec
commit ef2727f392
No known key found for this signature in database
GPG Key ID: 6D4E8D151FDE8C59
2 changed files with 16 additions and 1 deletions

View File

@ -28,6 +28,21 @@ describe("dotfiles", async () => {
expect(state.outputs.dotfiles_uri.value).toBe(default_dotfiles_uri);
});
it("command uses bash for fish shell compatibility", async () => {
const state = await runTerraformApply(import.meta.dir, {
agent_id: "foo",
manual_update: "true",
dotfiles_uri: "https://github.com/test/dotfiles",
});
const app = state.resources.find(
(r) => r.type === "coder_app" && r.name === "dotfiles"
);
expect(app).toBeDefined();
expect(app?.instances[0]?.attributes?.command).toContain("/bin/bash -c");
});
it("set custom order for coder_parameter", async () => {
const order = 99;
const state = await runTerraformApply(import.meta.dir, {

View File

@ -99,7 +99,7 @@ resource "coder_app" "dotfiles" {
icon = "/icon/dotfiles.svg"
order = var.order
group = var.group
command = "/usr/bin/env bash -c ${shellquote(templatefile("${path.module}/run.sh", {
command = "/bin/bash -c ${jsonencode(templatefile("${path.module}/run.sh", {
DOTFILES_URI : local.dotfiles_uri,
DOTFILES_USER : local.user
}))}"