refactor: clean up current code

mes/rdp-glitch-repro
Parkreiner 10 months ago
parent 7d366ff92a
commit 6409ee2bba

@ -1,6 +1,5 @@
import { describe, expect, it, test } from "bun:test"; import { describe, expect, it, test } from "bun:test";
import { import {
JsonValue,
TerraformState, TerraformState,
executeScriptInContainer, executeScriptInContainer,
runTerraformApply, runTerraformApply,
@ -38,7 +37,6 @@ describe("Web RDP", async () => {
it("Injects Terraform's username and password into the JS patch file", async () => { it("Injects Terraform's username and password into the JS patch file", async () => {
const findInstancesScript = (state: TerraformState): string | null => { const findInstancesScript = (state: TerraformState): string | null => {
let instancesScript: string | null = null;
for (const resource of state.resources) { for (const resource of state.resources) {
if (resource.type !== "coder_script") { if (resource.type !== "coder_script") {
continue; continue;
@ -46,12 +44,12 @@ describe("Web RDP", async () => {
for (const instance of resource.instances) { for (const instance of resource.instances) {
if (instance.attributes.display_name === "windows-rdp") { 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 * Tried going through the trouble of extracting out the form entries
* variable from the main output, converting it from Prettier/JS-based JSON * 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 * 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 * Written and tested via Regex101
* @see {@link https://regex101.com/r/UMgQpv/2} * @see {@link https://regex101.com/r/UMgQpv/2}

Loading…
Cancel
Save