@sprucelabs/spruce-cli
Version:
Command line interface for building Spruce skills.
92 lines • 4.24 kB
JavaScript
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const spruce_skill_utils_1 = require("@sprucelabs/spruce-skill-utils");
const test_utils_1 = require("@sprucelabs/test-utils");
const SchemaStore_1 = require("../../features/schema/stores/SchemaStore");
const AbstractSchemaTest_1 = __importDefault(require("../../tests/AbstractSchemaTest"));
class FeatureCommandExecuterTest extends AbstractSchemaTest_1.default {
static async shouldInstallDependentFeatures() {
const executer = this.Action('schema', 'create', {
shouldAutoHandleDependencies: true,
});
const promise = executer.execute({});
await this.waitForInput();
await this.ui.sendInput('yes');
await this.ui.sendInput('Skill with 1 dependency');
await this.ui.sendInput('A skill that is so good');
await this.waitForInput();
await this.ui.sendInput('\n');
await this.ui.sendInput('Restaurant');
await this.ui.sendInput('\n');
await this.wait(100);
const installer = this.featureInstaller;
let isInstalled = await installer.isInstalled('schema');
test_utils_1.assert.isFalse(isInstalled);
await promise;
await this.assertHealthySkillNamed('skill-with-1-dependency', {
skill: { status: 'passed' },
schema: {
status: 'passed',
schemas: this.generateExpectedHealthSchemas([
...Object.values(SchemaStore_1.coreSchemas),
{
id: 'restaurant',
name: 'Restaurant',
namespace: 'SkillWith1Dependency',
version: spruce_skill_utils_1.versionUtil.generateVersion().constValue,
},
]),
},
});
isInstalled = await installer.isInstalled('schema');
test_utils_1.assert.isTrue(isInstalled);
}
static async shouldInstallTwoDependentFeatures() {
const executer = this.Action('error', 'create', {
shouldAutoHandleDependencies: true,
});
const promise = executer.execute({});
await this.waitForInput();
await this.ui.sendInput('yes');
await this.ui.sendInput('My skill with 2 dependent features');
await this.ui.sendInput('A skill that is so good');
await this.waitForInput();
await this.ui.sendInput('\n');
await this.waitForInput();
await this.ui.sendInput('\n');
await this.ui.sendInput('Test error');
await this.ui.sendInput('\n');
await promise;
await this.assertHealthySkillNamed('my-skill-with-2-dependent-features', {
skill: { status: 'passed' },
schema: {
status: 'passed',
schemas: [],
},
error: {
errorSchemas: [{ name: 'Test error', id: 'testError' }],
status: 'passed',
},
});
const installer = this.featureInstaller;
const isInstalled = await installer.isInstalled('schema');
test_utils_1.assert.isTrue(isInstalled);
}
}
exports.default = FeatureCommandExecuterTest;
__decorate([
(0, test_utils_1.test)()
], FeatureCommandExecuterTest, "shouldInstallDependentFeatures", null);
__decorate([
(0, test_utils_1.test)()
], FeatureCommandExecuterTest, "shouldInstallTwoDependentFeatures", null);
//# sourceMappingURL=ActionExecuter.test.js.map