UNPKG

@sprucelabs/spruce-cli

Version:

Command line interface for building Spruce skills.

113 lines 4.44 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 test_utils_1 = require("@sprucelabs/test-utils"); const feature_utilities_1 = __importDefault(require("../../features/feature.utilities")); const AbstractCliTest_1 = __importDefault(require("../../tests/AbstractCliTest")); class OnboardingStoreTest extends AbstractCliTest_1.default { static store; static async beforeEach() { await super.beforeEach(); const store = this.OnboardingStore(); this.store = store; } static OnboardingStore() { const store = this.Store('onboarding'); return store; } static canGetStore() { test_utils_1.assert.isTruthy(this.store); } static startsAsOff() { const mode = this.store.getMode(); test_utils_1.assert.isEqual(mode, 'off'); } static canSetToShortMode() { this.store.setMode('short'); test_utils_1.assert.isEqual(this.store.getMode(), 'short'); } static canSetToImmersiveMode() { this.store.setMode('immersive'); test_utils_1.assert.isEqual(this.store.getMode(), 'immersive'); } static remembersModeBetweenBoots() { this.store.setMode('immersive'); const newStore = this.OnboardingStore(); test_utils_1.assert.isEqual(newStore.getMode(), 'immersive'); } static async remembersStageBetweenBoots() { const stage = feature_utilities_1.default.generateCommand('test', 'test'); this.store.setStage(stage); const newStore = this.OnboardingStore(); test_utils_1.assert.isEqual(newStore.getStage(), stage); } static valuesSharedBetween2Instances() { const store1 = this.OnboardingStore(); const store2 = this.OnboardingStore(); store1.setMode('immersive'); test_utils_1.assert.isEqual(store2.getMode(), store1.getMode()); } static stageIsNotSetToStart() { const currentStage = this.store.getStage(); test_utils_1.assert.isFalsy(currentStage); } static stageCanBeSet() { this.store.setStage('test'); const stage = this.store.getStage(); test_utils_1.assert.isEqual(stage, 'test'); } static canBeReset() { this.store.setStage('test'); this.store.reset(); const stage = this.store.getStage(); test_utils_1.assert.isFalsy(stage); test_utils_1.assert.isEqual(this.store.getMode(), 'off'); } static cantSetBadStage() { //@ts-ignore test_utils_1.assert.doesThrow(() => this.store.setStage('taco')); } } exports.default = OnboardingStoreTest; __decorate([ (0, test_utils_1.test)() ], OnboardingStoreTest, "canGetStore", null); __decorate([ (0, test_utils_1.test)() ], OnboardingStoreTest, "startsAsOff", null); __decorate([ (0, test_utils_1.test)() ], OnboardingStoreTest, "canSetToShortMode", null); __decorate([ (0, test_utils_1.test)() ], OnboardingStoreTest, "canSetToImmersiveMode", null); __decorate([ (0, test_utils_1.test)() ], OnboardingStoreTest, "remembersModeBetweenBoots", null); __decorate([ (0, test_utils_1.test)() ], OnboardingStoreTest, "remembersStageBetweenBoots", null); __decorate([ (0, test_utils_1.test)() ], OnboardingStoreTest, "valuesSharedBetween2Instances", null); __decorate([ (0, test_utils_1.test)() ], OnboardingStoreTest, "stageIsNotSetToStart", null); __decorate([ (0, test_utils_1.test)() ], OnboardingStoreTest, "stageCanBeSet", null); __decorate([ (0, test_utils_1.test)() ], OnboardingStoreTest, "canBeReset", null); __decorate([ (0, test_utils_1.test)() ], OnboardingStoreTest, "cantSetBadStage", null); //# sourceMappingURL=OnboardingStore.test.js.map