@sprucelabs/spruce-cli
Version:
Command line interface for building Spruce skills.
47 lines • 2.38 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 spruce_skill_utils_1 = require("@sprucelabs/spruce-skill-utils");
const test_utils_1 = require("@sprucelabs/test-utils");
const LintService_1 = __importDefault(require("../../services/LintService"));
const AbstractCliTest_1 = __importDefault(require("../../tests/AbstractCliTest"));
class BuildServiceTest extends AbstractCliTest_1.default {
static buildServiceExists() {
const service = this.Service('build');
test_utils_1.assert.isTruthy(service);
}
static async canBuildSkill() {
LintService_1.default.enableLinting();
await this.installSkill('skills');
const testFile = "const testVar = 'hello world'\nconsole.log(testVar)\n";
const destination = this.resolvePath('src/test.ts');
spruce_skill_utils_1.diskUtil.writeFile(destination, testFile);
const service = this.Service('build');
await service.build();
const builtFilePath = this.resolvePath('build/test.js');
const contents = spruce_skill_utils_1.diskUtil.readFile(builtFilePath);
test_utils_1.assert.isEqual(contents, `"use strict";
const testVar = 'hello world';
console.log(testVar);
//# sourceMappingURL=test.js.map`);
}
static async installSkill(cacheKey) {
await this.FeatureFixture().installCachedFeatures(cacheKey ?? 'skills');
}
}
exports.default = BuildServiceTest;
__decorate([
(0, test_utils_1.test)()
], BuildServiceTest, "buildServiceExists", null);
__decorate([
(0, test_utils_1.test)()
], BuildServiceTest, "canBuildSkill", null);
//# sourceMappingURL=BuildService.test.js.map