-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrust.test.ts
More file actions
44 lines (41 loc) · 1.89 KB
/
Copy pathrust.test.ts
File metadata and controls
44 lines (41 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { describe, it, expect } from 'vitest';
import { PluginTester, testSpawn } from '@codifycli/plugin-test';
import * as path from 'node:path';
import { SpawnStatus } from '@codifycli/plugin-core';
const pluginPath = path.resolve('./src/index.ts');
describe('Rust tests', async () => {
it('Can install and uninstall Rust via rustup', { timeout: 600000 }, async () => {
await PluginTester.fullTest(pluginPath, [{ type: 'rust' }], {
validateApply: async () => {
expect(await testSpawn('rustup --version')).toMatchObject({ status: SpawnStatus.SUCCESS });
expect(await testSpawn('rustc --version')).toMatchObject({ status: SpawnStatus.SUCCESS });
expect(await testSpawn('cargo --version')).toMatchObject({ status: SpawnStatus.SUCCESS });
},
validateDestroy: async () => {
expect(await testSpawn('rustup --version')).toMatchObject({ status: SpawnStatus.ERROR });
},
});
});
it('Can install Rust with cargo packages', { timeout: 900000 }, async () => {
await PluginTester.fullTest(
pluginPath,
[{ type: 'rust', cargoPackages: ['ripgrep'] }],
{
validateApply: async () => {
expect(await testSpawn('rustup --version')).toMatchObject({ status: SpawnStatus.SUCCESS });
expect(await testSpawn('rg --version')).toMatchObject({ status: SpawnStatus.SUCCESS });
},
testModify: {
modifiedConfigs: [{ type: 'rust', cargoPackages: ['ripgrep', 'fd-find'] }],
validateModify: async () => {
expect(await testSpawn('rg --version')).toMatchObject({ status: SpawnStatus.SUCCESS });
expect(await testSpawn('fd --version')).toMatchObject({ status: SpawnStatus.SUCCESS });
},
},
validateDestroy: async () => {
expect(await testSpawn('rustup --version')).toMatchObject({ status: SpawnStatus.ERROR });
},
}
);
});
});