@sprucelabs/spruce-cli
Version:
Command line interface for building Spruce skills.
57 lines (49 loc) • 1.63 kB
text/typescript
import { test, assert } from '@sprucelabs/test-utils'
import { errorAssert } from '@sprucelabs/test-utils'
import AbstractCliTest from '../../tests/AbstractCliTest'
export default class SettingUpANodeModuleTest extends AbstractCliTest {
()
protected static async settingUpANodeModule() {
const cli = await this.Cli()
const err = await assert.doesThrowAsync(() =>
cli.installFeatures({
features: [
{
code: 'node',
//@ts-ignore
options: {},
},
],
})
)
errorAssert.assertError(err, 'VALIDATION_FAILED')
}
()
protected static async canTellIfNotInstalled() {
const installer = this.featureInstaller
const isInstalled = await installer.isInstalled('node')
assert.isFalse(isInstalled)
}
()
protected static async installsNodeModuleWithCleanedUpPackageJson() {
const cli = await this.Cli()
await cli.installFeatures({
features: [
{
code: 'node',
options: {
name: 'Test module',
description: 'so great!',
},
},
],
})
const pkgService = this.Service('pkg')
const contents = pkgService.readPackage()
assert.doesInclude(contents, {
name: 'test-module',
description: 'so great!',
version: '0.0.1',
})
}
}