@@ -2,23 +2,13 @@ import { describe, expect, it } from 'vitest'
22import { PluginTester , testSpawn } from 'codify-plugin-test' ;
33import * as path from 'node:path' ;
44import { TestUtils } from '../test-utils.js' ;
5- import { SpawnStatus } from 'codify-plugin-lib' ;
5+ import { SpawnStatus , Utils } from 'codify-plugin-lib' ;
66
77// Currently need to figure out a way to test snap. It requires system ctl
8- describe ( 'Snap resource integration tests' , { skip : true } , ( ) => {
8+ describe ( 'Snap resource integration tests' , { skip : ! Utils . isLinux ( ) } , ( ) => {
99 const pluginPath = path . resolve ( './src/index.ts' ) ;
1010
1111 it ( 'Can install and uninstall snap packages' , { timeout : 300000 } , async ( ) => {
12- if ( ! TestUtils . isLinux ( ) ) {
13- console . log ( 'Skipping snap test - not running on Linux' ) ;
14- return ;
15- }
16-
17- // Check if snap is available
18- if ( ( await testSpawn ( 'which snap' ) ) . status !== SpawnStatus . SUCCESS ) {
19- console . log ( 'Skipping snap test - snap not available on this system' ) ;
20- return ;
21- }
2212
2313 // Plans correctly and detects that snap is available
2414 await PluginTester . fullTest ( pluginPath , [ {
@@ -47,8 +37,6 @@ describe('Snap resource integration tests', { skip: true }, () => {
4737 const snapList = ( await testSpawn ( 'snap list' ) ) . data ;
4838 expect ( snapList ) . toContain ( 'hello-world' ) ;
4939 expect ( snapList ) . toContain ( 'jq' ) ;
50- // curl should be removed
51- expect ( snapList ) . not . toContain ( 'curl' ) ;
5240 }
5341 } ,
5442 validateDestroy : async ( ) => {
@@ -59,17 +47,6 @@ describe('Snap resource integration tests', { skip: true }, () => {
5947 } ) ;
6048
6149 it ( 'Can install packages with specific channels' , { timeout : 300000 } , async ( ) => {
62- if ( ! TestUtils . isLinux ( ) ) {
63- console . log ( 'Skipping snap test - not running on Linux' ) ;
64- return ;
65- }
66-
67- // Check if snap is available
68- // if ((await testSpawn('which snap')).status !== SpawnStatus.SUCCESS) {
69- // console.log('Skipping snap test - snap not available on this system');
70- // return;
71- // }
72-
7350 await PluginTester . fullTest ( pluginPath , [ {
7451 type : 'snap' ,
7552 install : [
@@ -85,28 +62,20 @@ describe('Snap resource integration tests', { skip: true }, () => {
8562 } ) ;
8663
8764 it ( 'Can install classic snaps' , { timeout : 300000 } , async ( ) => {
88- if ( ! TestUtils . isLinux ( ) ) {
89- console . log ( 'Skipping snap test - not running on Linux' ) ;
90- return ;
91- }
92-
93- // Check if snap is available
94- // if ((await testSpawn('which snap')).status !== SpawnStatus.SUCCESS) {
95- // console.log('Skipping snap test - snap not available on this system');
96- // return;
97- // }
98-
9965 await PluginTester . fullTest ( pluginPath , [ {
10066 type : 'snap' ,
10167 install : [
102- { name : 'code ' , classic : true }
68+ { name : 'vault ' , classic : true }
10369 ]
10470 } ] , {
105- skipUninstall : true ,
10671 validateApply : async ( ) => {
10772 const snapList = ( await testSpawn ( 'snap list' ) ) . data ;
108- expect ( snapList ) . toContain ( 'code ' ) ;
73+ expect ( snapList ) . toContain ( 'vault ' ) ;
10974 } ,
11075 } ) ;
76+
77+ await PluginTester . install ( pluginPath , [ {
78+ type : 'snap' ,
79+ } ] )
11180 } ) ;
11281} ) ;
0 commit comments