UNPKG

@sprucelabs/spruce-cli

Version:

Command line interface for building Spruce skills.

83 lines 4.08 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 AbstractCliTest_1 = __importDefault(require("../../tests/AbstractCliTest")); class OrganizationStoreTest extends AbstractCliTest_1.default { static async canCreateStore() { test_utils_1.assert.isTruthy(this.Store('organization')); } static async skillIsNotInstalledByDefault() { await this.FeatureFixture().installCachedFeatures('organizations'); const org = await this.getOrganizationFixture().seedDemoOrg({ name: 'A cool org', }); const skill = await this.getSkillFixture().registerCurrentSkill({ name: 'a new skill', }); const isInstalled = await this.Store('organization').isSkillInstalledAtOrg(skill.id, org.id); test_utils_1.assert.isFalse(isInstalled); } static async canDeleteOrg() { await this.FeatureFixture().installCachedFeatures('organizations'); const org = await this.getOrganizationFixture().seedDemoOrg({ name: 'A cool org', }); const myOrgs = await this.Store('organization').fetchMyOrganizations(); test_utils_1.assert.doesInclude(myOrgs, org); await this.Store('organization').deleteOrganization(org.id); const myOrgs2 = await this.Store('organization').fetchMyOrganizations(); test_utils_1.assert.doesNotInclude(myOrgs2, org); } static async installSkill() { await this.FeatureFixture().installCachedFeatures('organizations'); const org = await this.getOrganizationFixture().seedDemoOrg({ name: 'A cool org', }); const skill = await this.getSkillFixture().registerCurrentSkill({ name: 'a new skill', }); await this.Store('organization').installSkillAtOrganization(skill.id, org.id); const isInstalled = await this.Store('organization').isSkillInstalledAtOrg(skill.id, org.id); test_utils_1.assert.isTrue(isInstalled); } static async canGetMyOrgs() { await this.FeatureFixture().installCachedFeatures('organizations'); const orgFixture = this.getOrganizationFixture(); const org1 = await orgFixture.seedDemoOrg({ name: 'A cool org', }); const org2 = await orgFixture.seedDemoOrg({ name: 'A cool org', }); const orgs = await this.Store('organization').fetchMyOrganizations(); test_utils_1.assert.isAbove(orgs.length, 1); test_utils_1.assert.doesInclude(orgs, org1); test_utils_1.assert.doesInclude(orgs, org2); } } exports.default = OrganizationStoreTest; __decorate([ (0, test_utils_1.test)() ], OrganizationStoreTest, "canCreateStore", null); __decorate([ (0, test_utils_1.test)() ], OrganizationStoreTest, "skillIsNotInstalledByDefault", null); __decorate([ test_utils_1.test.skip('conflicting with "InstallingASkillAtAnOrg which is deleting orgs') ], OrganizationStoreTest, "canDeleteOrg", null); __decorate([ (0, test_utils_1.test)() ], OrganizationStoreTest, "installSkill", null); __decorate([ test_utils_1.test.skip('is conflicting with "InstallingASkillAtAnOrg" which is deleting orgs') ], OrganizationStoreTest, "canGetMyOrgs", null); //# sourceMappingURL=OrganizationStore.test.js.map