UNPKG

@sprucelabs/spruce-cli

Version:

Command line interface for building Spruce skills.

46 lines 2.65 kB
"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 AbstractCliTest_1 = __importDefault(require("../../tests/AbstractCliTest")); const test_utility_1 = __importDefault(require("../../tests/utilities/test.utility")); class BootingWithBadFilesTest extends AbstractCliTest_1.default { static async bootingWithAEmptySchemaThrowsErrorWithNameOfBadSchema() { await this.FeatureFixture().installCachedFeatures('schemas'); const bootResults = await this.breakSchemaAndBoot(); test_utils_1.assert.isTruthy(bootResults.errors); test_utils_1.assert.doesInclude(bootResults.errors[0].message, 'location.schema.ts'); } static async disablesSchemaCheckingWithFlag() { await this.FeatureFixture().installCachedFeatures('schemas'); spruce_skill_utils_1.diskUtil.writeFile(this.resolvePath('.env'), 'SHOULD_VALIDATE_SCHEMAS_ON_BOOT=false'); const bootResults = await this.breakSchemaAndBoot(); test_utils_1.assert.isFalsy(bootResults.errors); } static async breakSchemaAndBoot() { const results = await this.Action('schema', 'sync').execute({}); const match = test_utility_1.default.assertFileByNameInGeneratedFiles('location.schema.ts', results.files); spruce_skill_utils_1.diskUtil.writeFile(match, ''); const bootResults = await this.Action('skill', 'boot').execute({ local: true, }); return bootResults; } } exports.default = BootingWithBadFilesTest; __decorate([ (0, test_utils_1.test)() ], BootingWithBadFilesTest, "bootingWithAEmptySchemaThrowsErrorWithNameOfBadSchema", null); __decorate([ (0, test_utils_1.test)() ], BootingWithBadFilesTest, "disablesSchemaCheckingWithFlag", null); //# sourceMappingURL=BootingWithBadFiles.test.js.map