From 264584e673f6d6c5b31f74fe24fb90119fe245fd Mon Sep 17 00:00:00 2001 From: Parkreiner Date: Wed, 26 Jun 2024 17:59:12 +0000 Subject: [PATCH] fix: make comments for test helpers exportable --- test.ts | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/test.ts b/test.ts index faac253..2601d0e 100644 --- a/test.ts +++ b/test.ts @@ -29,8 +29,10 @@ export const runContainer = async ( return containerID.trim(); }; -// executeScriptInContainer finds the only "coder_script" -// resource in the given state and runs it in a container. +/** + * Finds the only "coder_script" resource in the given state and runs it in a + * container. + */ export const executeScriptInContainer = async ( state: TerraformState, image: string, @@ -100,10 +102,11 @@ export interface CoderScriptAttributes { url: string; } -// findResourceInstance finds the first instance of the given resource -// type in the given state. If name is specified, it will only find -// the instance with the given name. -export const findResourceInstance = ( +/** + * finds the first instance of the given resource type in the given state. If + * name is specified, it will only find the instance with the given name. + */ +export const findResourceInstance = ( state: TerraformState, type: T, name?: string, @@ -126,9 +129,10 @@ export const findResourceInstance = ( return resource.instances[0].attributes as any; }; -// testRequiredVariables creates a test-case -// for each variable provided and ensures that -// the apply fails without it. +/** + * Creates a test-case for each variable provided and ensures that the apply + * fails without it. + */ export const testRequiredVariables = ( dir: string, vars: Record, @@ -160,9 +164,11 @@ export const testRequiredVariables = ( }); }; -// runTerraformApply runs terraform apply in the given directory -// with the given variables. It is fine to run in parallel with -// other instances of this function, as it uses a random state file. +/** + * Runs terraform apply in the given directory with the given variables. It is + * fine to run in parallel with other instances of this function, as it uses a + * random state file. + */ export const runTerraformApply = async < TVars extends Readonly>, >( @@ -200,7 +206,9 @@ export const runTerraformApply = async < return JSON.parse(content); }; -// runTerraformInit runs terraform init in the given directory. +/** + * Runs terraform init in the given directory. + */ export const runTerraformInit = async (dir: string) => { const proc = spawn(["terraform", "init"], { cwd: dir,