From 6409ee2bbaf59ab5a441a4b00a5615f98bc5a039 Mon Sep 17 00:00:00 2001 From: Parkreiner Date: Thu, 27 Jun 2024 17:23:01 +0000 Subject: [PATCH] refactor: clean up current code --- windows-rdp/main.test.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/windows-rdp/main.test.ts b/windows-rdp/main.test.ts index 64738e0..16703e3 100644 --- a/windows-rdp/main.test.ts +++ b/windows-rdp/main.test.ts @@ -1,6 +1,5 @@ import { describe, expect, it, test } from "bun:test"; import { - JsonValue, TerraformState, executeScriptInContainer, runTerraformApply, @@ -38,7 +37,6 @@ describe("Web RDP", async () => { it("Injects Terraform's username and password into the JS patch file", async () => { const findInstancesScript = (state: TerraformState): string | null => { - let instancesScript: string | null = null; for (const resource of state.resources) { if (resource.type !== "coder_script") { continue; @@ -46,12 +44,12 @@ describe("Web RDP", async () => { for (const instance of resource.instances) { if (instance.attributes.display_name === "windows-rdp") { - instancesScript = instance.attributes.script; + return instance.attributes.script as string; } } } - return instancesScript; + return null; }; /** @@ -61,7 +59,7 @@ describe("Web RDP", async () => { * Tried going through the trouble of extracting out the form entries * variable from the main output, converting it from Prettier/JS-based JSON * text to universal JSON text, and exposing it as a parsed JSON value. That - * got to be too much, though. + * got to be a bit too much, though. * * Written and tested via Regex101 * @see {@link https://regex101.com/r/UMgQpv/2}