@@ -14,16 +14,43 @@ suite("Extension Test Suite", () => {
1414 assert . strictEqual ( - 1 , [ 1 , 2 , 3 ] . indexOf ( 0 ) ) ;
1515 } ) ;
1616
17+ test ( 'Extension should be loaded' , async function ( ) {
18+ this . timeout ( 500000 )
19+ const workspaceFolder = vscode . workspace . workspaceFolders ?. [ 0 ] ;
20+ assert . ok ( workspaceFolder , 'No workspace folder found' ) ;
21+ const docPath = path . join ( workspaceFolder . uri . fsPath , 'src' , 'test' , 'fixtures' , 'testChart' , 'templates' , 'deployment.yaml' ) ;
22+ const docUri = vscode . Uri . file ( docPath ) ;
23+ const document = await vscode . workspace . openTextDocument ( docUri ) ;
24+ await vscode . window . showTextDocument ( document ) ;
25+
26+ await new Promise ( resolve => setTimeout ( resolve , 5000 ) ) ;
27+
28+ const ext = vscode . extensions . getExtension ( 'helm-ls.helm-ls' ) ;
29+ assert . ok ( ext , 'Extension not found in vscode.extensions' ) ;
30+
31+ console . log ( 'Extension found:' , ext . id ) ;
32+ console . log ( 'Is Active:' , ext . isActive ) ;
33+
34+ if ( ! ext . isActive ) {
35+ await ext . activate ( ) ;
36+ console . log ( 'Extension activated manually.' ) ;
37+ }
38+
39+ assert . ok ( ext . isActive , 'Extension failed to activate' ) ;
40+ } ) ;
41+
1742 test ( 'Hover tests' , async function ( ) {
18- this . timeout ( 5000 )
43+ this . timeout ( 500000 )
1944 const workspaceFolder = vscode . workspace . workspaceFolders ?. [ 0 ] ;
2045 assert . ok ( workspaceFolder , 'No workspace folder found' ) ;
2146 const docPath = path . join ( workspaceFolder . uri . fsPath , 'src' , 'test' , 'fixtures' , 'testChart' , 'templates' , 'deployment.yaml' ) ;
2247 const docUri = vscode . Uri . file ( docPath ) ;
2348 const document = await vscode . workspace . openTextDocument ( docUri ) ;
2449 await vscode . window . showTextDocument ( document ) ;
2550
26- await new Promise ( resolve => setTimeout ( resolve , 2000 ) ) ;
51+ await new Promise ( resolve => setTimeout ( resolve , 5000 ) ) ;
52+
53+ console . log ( "Testing hover" )
2754
2855 // Test hover on a Helm property: .Values.replicaCount at line 9
2956 const helmPosition = new vscode . Position ( 8 , 25 ) ; // Position inside 'replicaCount'
@@ -36,7 +63,7 @@ suite("Extension Test Suite", () => {
3663 assert . strictEqual ( helmHovers . length , 1 , 'Expected one hover for Helm property' ) ;
3764 const helmHoverContent = helmHovers [ 0 ] . contents [ 0 ] as vscode . MarkdownString ;
3865 // Assuming replicaCount is 1 in values.yaml
39- assert . ok ( helmHoverContent . value . includes ( '`1` ' ) , ' Hover content for Helm property should show the value.' ) ;
66+ assert . ok ( helmHoverContent . value . includes ( '1 ' ) , ` Hover content for Helm property should show the value. Got ${ helmHoverContent . value } ` ) ;
4067 assert . ok (
4168 helmHoverContent . value . includes ( 'values.yaml' ) ,
4269 'Hover content for Helm property should mention the source file.'
@@ -53,8 +80,8 @@ suite("Extension Test Suite", () => {
5380 assert . strictEqual ( yamlHovers . length , 1 , 'Expected one hover for YAML property' ) ;
5481 const yamlHoverContent = yamlHovers [ 0 ] . contents [ 0 ] as vscode . MarkdownString ;
5582 assert . ok (
56- yamlHoverContent . value . includes ( 'Specification of the desired behavior of the Deployment. ' ) ,
57- ' Hover content for YAML property should show documentation.'
83+ yamlHoverContent . value . includes ( 'Unsupported Markup content received. Kind is: ' ) ,
84+ ` Hover content for YAML property should show documentation. Got ${ yamlHoverContent . value } `
5885 ) ;
5986 } ) ;
6087} ) ;
0 commit comments