@sprucelabs/spruce-cli
Version:
Command line interface for building Spruce skills.
53 lines • 3.05 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 });
require("@sprucelabs/spruce-conversation-plugin");
const test_utils_1 = require("@sprucelabs/test-utils");
const AbstractCliTest_1 = __importDefault(require("../../../tests/AbstractCliTest"));
const test_utility_1 = __importDefault(require("../../../tests/utilities/test.utility"));
class CreatingAConversationTopicTest extends AbstractCliTest_1.default {
static async hasCreateConversationAction() {
test_utils_1.assert.isFunction(this.Action('conversation', 'create').execute);
}
static async createsValidConversationTopicDefinition() {
const cli = await this.FeatureFixture().installCachedFeatures('conversation');
const results = await this.Action('conversation', 'create').execute({
nameReadable: 'book an appointment',
nameCamel: 'bookAnAppointment',
});
const match = test_utility_1.default.assertFileByNameInGeneratedFiles('bookAnAppointment.topic.ts', results.files);
const imported = await this.Service('import').importDefault(match);
test_utils_1.assert.isTruthy(imported);
test_utils_1.assert.isEqual(imported.label, 'book an appointment');
test_utils_1.assert.isArray(imported.utterances);
test_utils_1.assert.isArray(imported.script);
await this.assertHealthCheckResultsAreValid(cli);
}
static async assertHealthCheckResultsAreValid(cli) {
const health = await cli.checkHealth();
//@ts-ignore
test_utils_1.assert.isTruthy(health.conversation);
//@ts-ignore
test_utils_1.assert.isArray(health.conversation.topics);
//@ts-ignore
test_utils_1.assert.isLength(health.conversation.topics, 1);
//@ts-ignore
test_utils_1.assert.doesInclude(health.conversation.topics, 'bookAnAppointment');
}
}
exports.default = CreatingAConversationTopicTest;
__decorate([
test_utils_1.test.skip('bring back if re introducing conversation topics')
], CreatingAConversationTopicTest, "hasCreateConversationAction", null);
__decorate([
test_utils_1.test.skip('bring back if re introducing conversation topics')
], CreatingAConversationTopicTest, "createsValidConversationTopicDefinition", null);
//# sourceMappingURL=CreatingAConversationTopic.test.js.map