UNPKG

@sprucelabs/spruce-cli

Version:

Command line interface for building Spruce skills.

63 lines 3.26 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 SchemaStore_1 = require("../../../features/schema/stores/SchemaStore"); const AbstractSchemaTest_1 = __importDefault(require("../../../tests/AbstractSchemaTest")); class GettingSchemasFromHealthCheckTest extends AbstractSchemaTest_1.default { static async getsCoreSchemasFromHealthCheck() { const cli = await this.installAndSyncSchemas(); const cleanedExpected = this.generateExpectedHealthSchemas(Object.values(SchemaStore_1.coreSchemas)); await this.assertExpectedSchemas(cli, cleanedExpected); } static async getsCoreAndLocalSchemasFromHealthCheck() { const cli = await this.installAndSyncSchemas(); const createSchema = this.Action('schema', 'create'); await createSchema.execute({ nameReadable: 'Test schema!', namePascal: 'Test', nameCamel: 'test', description: 'this is so great!', }); const cleanedExpected = this.generateExpectedHealthSchemas([ ...Object.values(SchemaStore_1.coreSchemas), { id: 'test', name: 'Test schema!', version: spruce_skill_utils_1.versionUtil.generateVersion().constValue, namespace: 'TestingSchemas', description: 'this is so great!', }, ]); await this.assertExpectedSchemas(cli, cleanedExpected); } static async installAndSyncSchemas() { const cli = await this.installSchemaFeature('schemas'); await this.Action('schema', 'sync').execute({}); return cli; } static async assertExpectedSchemas(cli, expected) { const health = await cli.checkHealth(); test_utils_1.assert.isFalsy(health.skill.errors); test_utils_1.assert.isTruthy(health.schema); test_utils_1.assert.isEqual(health.schema.status, 'passed'); test_utils_1.assert.isEqualDeep(this.sortSchemas(health.schema.schemas), expected); } } exports.default = GettingSchemasFromHealthCheckTest; __decorate([ (0, test_utils_1.test)() ], GettingSchemasFromHealthCheckTest, "getsCoreSchemasFromHealthCheck", null); __decorate([ (0, test_utils_1.test)() ], GettingSchemasFromHealthCheckTest, "getsCoreAndLocalSchemasFromHealthCheck", null); //# sourceMappingURL=GettingSchemasFromHealthCheck.test.js.map