@sprucelabs/spruce-cli
Version:
Command line interface for building Spruce skills.
48 lines • 2.45 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 ParentTestFinder_1 = __importDefault(require("../../features/error/ParentTestFinder"));
const AbstractCliTest_1 = __importDefault(require("../../tests/AbstractCliTest"));
class ParentTestFinderTest extends AbstractCliTest_1.default {
static async canCreateFinder() {
const finder = new ParentTestFinder_1.default(this.cwd);
test_utils_1.assert.isTruthy(finder);
}
static async canFindAbstractTests() {
await this.copyTestFiles();
const testFinder = new ParentTestFinder_1.default(this.cwd);
const matches = await testFinder.findAbstractTests();
test_utils_1.assert.isLength(matches, 3);
test_utils_1.assert.doesInclude(matches, {
name: 'AbstractTest',
path: this.resolvePath('src', 'AbstractTest.ts'),
});
test_utils_1.assert.doesInclude(matches, {
name: 'AbstractBananaTestDifferentThanFileName',
path: this.resolvePath('src', 'deeper', 'AbstractBananaTest.ts'),
});
}
static async copyTestFiles() {
const source = this.resolveTestPath('abstract_tests');
const destination = this.resolvePath('src');
await spruce_skill_utils_1.diskUtil.copyDir(source, destination);
}
}
exports.default = ParentTestFinderTest;
__decorate([
(0, test_utils_1.test)()
], ParentTestFinderTest, "canCreateFinder", null);
__decorate([
(0, test_utils_1.test)()
], ParentTestFinderTest, "canFindAbstractTests", null);
//# sourceMappingURL=ParentTestFinder.test.js.map