|
| 1 | +import { beforeAll, describe, expect, it, test } from "bun:test"; |
| 2 | +import { |
| 3 | + executeScriptInContainer, |
| 4 | + runTerraformApply, |
| 5 | + runTerraformInit, |
| 6 | + testRequiredVariables, |
| 7 | +} from "../test"; |
| 8 | + |
| 9 | +type TestVariables = Readonly<{ |
| 10 | + agent_id: string; |
| 11 | + resource_id: string; |
| 12 | + admin_username?: string; |
| 13 | + admin_password?: string; |
| 14 | +}>; |
| 15 | + |
| 16 | +describe("Web RDP", () => { |
| 17 | + beforeAll(async () => { |
| 18 | + await runTerraformInit(import.meta.dir); |
| 19 | + testRequiredVariables(import.meta.dir, { |
| 20 | + agent_id: "foo", |
| 21 | + resource_id: "bar", |
| 22 | + }); |
| 23 | + }); |
| 24 | + |
| 25 | + it("Patches the Devolutions Angular app's .html file (after it has been bundled) to include an import for the custom JS file", async () => { |
| 26 | + const state = await runTerraformApply<TestVariables>(import.meta.dir, { |
| 27 | + agent_id: "foo", |
| 28 | + resource_id: "bar", |
| 29 | + }); |
| 30 | + |
| 31 | + throw new Error("Not implemented yet"); |
| 32 | + }); |
| 33 | + |
| 34 | + it("Injects the Terraform username and password into the JS patch file", async () => { |
| 35 | + throw new Error("Not implemented yet"); |
| 36 | + |
| 37 | + // Test that things work with the default username/password |
| 38 | + const defaultState = await runTerraformApply<TestVariables>( |
| 39 | + import.meta.dir, |
| 40 | + { |
| 41 | + agent_id: "foo", |
| 42 | + resource_id: "bar", |
| 43 | + }, |
| 44 | + ); |
| 45 | + |
| 46 | + const output = await executeScriptInContainer(defaultState, "alpine"); |
| 47 | + |
| 48 | + // Test that custom usernames/passwords are also forwarded correctly |
| 49 | + const customUsername = "crouton"; |
| 50 | + const customPassword = "VeryVeryVeryVeryVerySecurePassword97!"; |
| 51 | + const customizedState = await runTerraformApply<TestVariables>( |
| 52 | + import.meta.dir, |
| 53 | + { |
| 54 | + agent_id: "foo", |
| 55 | + resource_id: "bar", |
| 56 | + admin_username: customUsername, |
| 57 | + admin_password: customPassword, |
| 58 | + }, |
| 59 | + ); |
| 60 | + }); |
| 61 | +}); |
0 commit comments