UNPKG

@sprucelabs/spruce-cli

Version:

Command line interface for building Spruce skills.

38 lines 2.47 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 AbstractSchemaTest_1 = __importDefault(require("../../../tests/AbstractSchemaTest")); const test_utility_1 = __importDefault(require("../../../tests/utilities/test.utility")); class CreatingSchemasWithGenericsTest extends AbstractSchemaTest_1.default { static async schemaImportsLocalImports() { await this.installSchemaFeature('schemas'); const source = this.resolveTestPath('schemas_with_suffix'); const destination = this.resolvePath('src', 'schemas'); await spruce_skill_utils_1.diskUtil.copyDir(source, destination); const results = await this.Action('schema', 'sync').execute({}); test_utils_1.assert.isFalsy(results.errors); test_utils_1.assert.isTruthy(results.files); const match = test_utility_1.default.assertFileByNameInGeneratedFiles('schemas.types.ts', results.files); const contents = spruce_skill_utils_1.diskUtil.readFile(match); test_utils_1.assert.doesInclude(contents, '<Type extends string = string>'); test_utils_1.assert.doesInclude(contents, '<Type2 extends string = string>'); test_utils_1.assert.doesInclude(contents, '<Type>'); test_utils_1.assert.doesInclude(contents, "'typedByGeneric'?: (Type2) | undefined | null"); await this.assertValidActionResponseFiles(results); } } exports.default = CreatingSchemasWithGenericsTest; __decorate([ (0, test_utils_1.test)() ], CreatingSchemasWithGenericsTest, "schemaImportsLocalImports", null); //# sourceMappingURL=CreatingSchemasWithGenerics.test.js.map