File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
registry/anomaly/modules/tmux Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ import { describe , it , expect } from "bun:test" ;
2+ import {
3+ runTerraformApply ,
4+ runTerraformInit ,
5+ testRequiredVariables ,
6+ findResourceInstance ,
7+ } from "~test" ;
8+ import path from "path" ;
9+
10+ const moduleDir = path . resolve ( __dirname ) ;
11+
12+ const requiredVars = {
13+ agent_id : "dummy-agent-id" ,
14+ } ;
15+
16+ describe ( "tmux module" , async ( ) => {
17+ await runTerraformInit ( moduleDir ) ;
18+
19+ // 1. Required variables
20+ testRequiredVariables ( moduleDir , requiredVars ) ;
21+
22+ // 2. coder_script resource is created
23+ it ( "creates coder_script resource" , async ( ) => {
24+ const state = await runTerraformApply ( moduleDir , requiredVars ) ;
25+ const scriptResource = findResourceInstance ( state , "coder_script" ) ;
26+ expect ( scriptResource ) . toBeDefined ( ) ;
27+ expect ( scriptResource . agent_id ) . toBe ( requiredVars . agent_id ) ;
28+
29+ // check that the script contains expected lines
30+ expect ( scriptResource . script ) . toContain ( "Installing tmux" ) ;
31+ expect ( scriptResource . script ) . toContain ( "Installing Tmux Plugin Manager (TPM)" ) ;
32+ expect ( scriptResource . script ) . toContain ( "tmux configuration created at" ) ;
33+ expect ( scriptResource . script ) . toContain ( "✅ tmux setup complete!" ) ;
34+ } ) ;
35+ } ) ;
You can’t perform that action at this time.
0 commit comments