diff --git a/windows-rdp/main.test.ts b/windows-rdp/main.test.ts new file mode 100644 index 0000000..b6d0e09 --- /dev/null +++ b/windows-rdp/main.test.ts @@ -0,0 +1,61 @@ +import { beforeAll, describe, expect, it, test } from "bun:test"; +import { + executeScriptInContainer, + runTerraformApply, + runTerraformInit, + testRequiredVariables, +} from "../test"; + +type TestVariables = Readonly<{ + agent_id: string; + resource_id: string; + admin_username?: string; + admin_password?: string; +}>; + +describe("Web RDP", () => { + beforeAll(async () => { + await runTerraformInit(import.meta.dir); + testRequiredVariables(import.meta.dir, { + agent_id: "foo", + resource_id: "bar", + }); + }); + + it("Patches the Devolutions Angular app's .html file (after it has been bundled) to include an import for the custom JS file", async () => { + const state = await runTerraformApply(import.meta.dir, { + agent_id: "foo", + resource_id: "bar", + }); + + throw new Error("Not implemented yet"); + }); + + it("Injects the Terraform username and password into the JS patch file", async () => { + throw new Error("Not implemented yet"); + + // Test that things work with the default username/password + const defaultState = await runTerraformApply( + import.meta.dir, + { + agent_id: "foo", + resource_id: "bar", + }, + ); + + const output = await executeScriptInContainer(defaultState, "alpine"); + + // Test that custom usernames/passwords are also forwarded correctly + const customUsername = "crouton"; + const customPassword = "VeryVeryVeryVeryVerySecurePassword97!"; + const customizedState = await runTerraformApply( + import.meta.dir, + { + agent_id: "foo", + resource_id: "bar", + admin_username: customUsername, + admin_password: customPassword, + }, + ); + }); +});