UNPKG

@sprucelabs/spruce-cli

Version:

Command line interface for building Spruce skills.

71 lines 3.81 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 path_1 = __importDefault(require("path")); 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 UpgradingWithSandboxFeatureInstalledTest extends AbstractCliTest_1.default { static async beforeEach() { await super.beforeEach(); await this.FeatureFixture().installCachedFeatures('sandbox'); await this.listenToDidInstallInThePast(); } static async doesNotAskForVersionWhenSettingUpSandboxWithCoreListener() { await this.setup(); } static async usesTodaysVersionEvenWithCoreListener() { const match = await this.setupAndGetListenerPath(); const fileName = path_1.default.basename(match); const expected = `will-boot.${spruce_skill_utils_1.versionUtil.generateVersion().dirValue}.listener.ts`; test_utils_1.assert.isEqual(fileName, expected); } static async overwritesExistingWillBoot() { const expected = `will-boot.v2010_01_10.listener.ts`; const match = await this.setupAndGetListenerPath(); spruce_skill_utils_1.diskUtil.deleteFile(match); spruce_skill_utils_1.diskUtil.writeFile(this.resolvePath(path_1.default.dirname(match), expected), 'export default async () => {}'); const syncResults = await this.Action('event', 'syncListeners').execute({}); test_utils_1.assert.isFalsy(syncResults.errors); const secondMatch = await this.setupAndGetListenerPath(); const name = path_1.default.basename(secondMatch); test_utils_1.assert.isEqual(name, expected); } static async setupAndGetListenerPath() { const results = await this.setup(); const match = test_utility_1.default.assertFileByNameInGeneratedFiles(/will-boot/gi, results.files); return match; } static async setup() { const results = await this.Action('sandbox', 'setup').execute({}); test_utils_1.assert.isFalsy(results.errors); return results; } static async listenToDidInstallInThePast() { const results = await this.Action('event', 'listen').execute({ namespace: 'mercury', eventName: 'did-install::v2020_12_25', }); test_utils_1.assert.isFalsy(results.errors); } } exports.default = UpgradingWithSandboxFeatureInstalledTest; __decorate([ (0, test_utils_1.test)() ], UpgradingWithSandboxFeatureInstalledTest, "doesNotAskForVersionWhenSettingUpSandboxWithCoreListener", null); __decorate([ (0, test_utils_1.test)() ], UpgradingWithSandboxFeatureInstalledTest, "usesTodaysVersionEvenWithCoreListener", null); __decorate([ (0, test_utils_1.test)() ], UpgradingWithSandboxFeatureInstalledTest, "overwritesExistingWillBoot", null); //# sourceMappingURL=UpgradingWithSandboxFeatureInstalled.test.js.map