@sprucelabs/spruce-cli
Version:
Command line interface for building Spruce skills.
61 lines • 2.97 kB
JavaScript
;
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 test_utils_1 = require("@sprucelabs/test-utils");
const test_utils_2 = require("@sprucelabs/test-utils");
const AbstractSchemaTest_1 = __importDefault(require("../../tests/AbstractSchemaTest"));
class FeatureCommandExecuterTest extends AbstractSchemaTest_1.default {
static async canInstantiateExecuter() {
const executer = this.Action('schema', 'create', {
shouldAutoHandleDependencies: true,
});
test_utils_1.assert.isTruthy(executer);
}
static async throwWhenExecutingWhenMissingDependencies() {
const err = await test_utils_1.assert.doesThrowAsync(() => this.Action('skill', 'create').execute({}));
test_utils_2.errorAssert.assertError(err, 'FEATURE_NOT_INSTALLED');
}
static async shouldAskAllQuestionsOfFeature() {
const executer = this.Action('skill', 'create', {
shouldAutoHandleDependencies: true,
});
const promise = executer.execute({});
await this.waitForInput();
await this.ui.sendInput('My new skill');
await this.ui.sendInput('So great!');
await promise;
await this.assertHealthySkillNamed('my-new-skill');
}
static async shouldNotAskAlreadyAnsweredQuestions() {
const executer = this.Action('skill', 'create', {
shouldAutoHandleDependencies: true,
});
const promise = executer.execute({ description: 'go team!' });
await this.waitForInput();
void this.ui.sendInput('Already answered skill');
await promise;
await this.assertHealthySkillNamed('already-answered-skill');
}
}
exports.default = FeatureCommandExecuterTest;
__decorate([
(0, test_utils_1.test)()
], FeatureCommandExecuterTest, "canInstantiateExecuter", null);
__decorate([
(0, test_utils_1.test)()
], FeatureCommandExecuterTest, "throwWhenExecutingWhenMissingDependencies", null);
__decorate([
(0, test_utils_1.test)()
], FeatureCommandExecuterTest, "shouldAskAllQuestionsOfFeature", null);
__decorate([
(0, test_utils_1.test)()
], FeatureCommandExecuterTest, "shouldNotAskAlreadyAnsweredQuestions", null);
//# sourceMappingURL=ActionExecuter3.test.js.map