@sprucelabs/spruce-test-fixtures 62.0.129 → 62.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -53,6 +53,7 @@ export default class ViewFixtureTest extends AbstractSpruceFixtureTest {
53
53
  protected static newDeviceBeforeEach(): Promise<void>;
54
54
  protected static mutesLogs(): Promise<void>;
55
55
  protected static buildVcPluginExposedInFixture(): Promise<void>;
56
+ protected static addPluginExposedInFixure(): Promise<void>;
56
57
  private static ViewFixture;
57
58
  private static buildLoadOptions;
58
59
  private static ScopedByOrgVc;
@@ -457,6 +457,20 @@ let ViewFixtureTest = class ViewFixtureTest extends AbstractSpruceFixtureTest_1.
457
457
  test_utils_1.assert.isEqual(PassedClass, SpyVcPlugin);
458
458
  test_utils_1.assert.isEqual(plugin, response);
459
459
  }
460
+ static async addPluginExposedInFixure() {
461
+ const factory = this.fixture.getFactory();
462
+ const name = (0, test_utils_2.generateId)();
463
+ let passedName;
464
+ let passedPlugin;
465
+ const plugin = this.fixture.BuildPlugin(SpyVcPlugin);
466
+ factory.addPlugin = (named, plugin) => {
467
+ passedName = named;
468
+ passedPlugin = plugin;
469
+ };
470
+ this.fixture.addPlugin(name, plugin);
471
+ test_utils_1.assert.isEqual(passedName, name);
472
+ test_utils_1.assert.isEqual(passedPlugin, plugin);
473
+ }
460
474
  static ViewFixture() {
461
475
  return this.Fixture('view', {
462
476
  controllerMap: {
@@ -656,6 +670,9 @@ __decorate([
656
670
  __decorate([
657
671
  (0, test_utils_1.test)()
658
672
  ], ViewFixtureTest, "buildVcPluginExposedInFixture", null);
673
+ __decorate([
674
+ (0, test_utils_1.test)()
675
+ ], ViewFixtureTest, "addPluginExposedInFixure", null);
659
676
  ViewFixtureTest = __decorate([
660
677
  fake_1.default.login(DEMO_NUMBER_FORMATTED)
661
678
  ], ViewFixtureTest);
@@ -53,6 +53,7 @@ export default class ViewFixtureTest extends AbstractSpruceFixtureTest {
53
53
  protected static newDeviceBeforeEach(): Promise<void>;
54
54
  protected static mutesLogs(): Promise<void>;
55
55
  protected static buildVcPluginExposedInFixture(): Promise<void>;
56
+ protected static addPluginExposedInFixure(): Promise<void>;
56
57
  private static ViewFixture;
57
58
  private static buildLoadOptions;
58
59
  private static ScopedByOrgVc;
@@ -538,6 +538,22 @@ let ViewFixtureTest = class ViewFixtureTest extends AbstractSpruceFixtureTest {
538
538
  assert.isEqual(plugin, response);
539
539
  });
540
540
  }
541
+ static addPluginExposedInFixure() {
542
+ return __awaiter(this, void 0, void 0, function* () {
543
+ const factory = this.fixture.getFactory();
544
+ const name = generateId();
545
+ let passedName;
546
+ let passedPlugin;
547
+ const plugin = this.fixture.BuildPlugin(SpyVcPlugin);
548
+ factory.addPlugin = (named, plugin) => {
549
+ passedName = named;
550
+ passedPlugin = plugin;
551
+ };
552
+ this.fixture.addPlugin(name, plugin);
553
+ assert.isEqual(passedName, name);
554
+ assert.isEqual(passedPlugin, plugin);
555
+ });
556
+ }
541
557
  static ViewFixture() {
542
558
  return this.Fixture('view', {
543
559
  controllerMap: {
@@ -741,6 +757,9 @@ __decorate([
741
757
  __decorate([
742
758
  test()
743
759
  ], ViewFixtureTest, "buildVcPluginExposedInFixture", null);
760
+ __decorate([
761
+ test()
762
+ ], ViewFixtureTest, "addPluginExposedInFixure", null);
744
763
  ViewFixtureTest = __decorate([
745
764
  fake.login(DEMO_NUMBER_FORMATTED)
746
765
  ], ViewFixtureTest);
@@ -16,7 +16,6 @@ import StoreFixture from './fixtures/StoreFixture';
16
16
  import ViewFixture from './fixtures/ViewFixture';
17
17
  export default abstract class AbstractSpruceFixtureTest extends AbstractSkillTest {
18
18
  static fakedPerson: Person;
19
- static fakedClient: MercuryClient;
20
19
  static fakedPeople: Person[];
21
20
  static fakedTeammates: Person[];
22
21
  static fakedOwners: Person[];
@@ -28,6 +27,7 @@ export default abstract class AbstractSpruceFixtureTest extends AbstractSkillTes
28
27
  private static _fakedOrganizations;
29
28
  private static _fakedLocations;
30
29
  static cwd: string;
30
+ static _fakedClient?: MercuryClient;
31
31
  private static _views?;
32
32
  private static _roles?;
33
33
  private static _locations?;
@@ -76,6 +76,8 @@ export default abstract class AbstractSpruceFixtureTest extends AbstractSkillTes
76
76
  executionPromise: Promise<void>;
77
77
  }>;
78
78
  protected static SkillFromTestDir(key: string, options?: SkillFactoryOptions | undefined): Promise<Skill>;
79
+ static get fakedClient(): MercuryClient;
80
+ static set fakedClient(client: MercuryClient);
79
81
  static get fakedOrganizations(): Organization[];
80
82
  static set fakedOrganizations(orgs: Organization[]);
81
83
  static get fakedLocations(): Location[];
@@ -125,6 +125,13 @@ class AbstractSpruceFixtureTest extends AbstractSkillTest {
125
125
  return skill;
126
126
  });
127
127
  }
128
+ static get fakedClient() {
129
+ assert.isTruthy(this._fakedClient, `You gotta @fake.login() on your test class to get the test client.`);
130
+ return this._fakedClient;
131
+ }
132
+ static set fakedClient(client) {
133
+ this._fakedClient = client;
134
+ }
128
135
  static get fakedOrganizations() {
129
136
  return this._fakedOrganizations;
130
137
  }
@@ -44,6 +44,7 @@ export default class ViewFixture {
44
44
  proxyDecorator: ClientProxyDecorator;
45
45
  permissions: PermissionFixture;
46
46
  });
47
+ addPlugin(name: string, plugin: ViewControllerPlugin): void;
47
48
  getFactory(): ViewControllerFactory;
48
49
  BuildPlugin<P extends ViewControllerPlugin>(Plugin: new (options: ViewControllerPluginOptions) => P): P;
49
50
  getMaps(): import("../../utilities/SpyMapUtil").SpyMapUtil;
@@ -48,6 +48,9 @@ class ViewFixture {
48
48
  organizations: this.orgs,
49
49
  });
50
50
  }
51
+ addPlugin(name, plugin) {
52
+ this.getFactory().addPlugin(name, plugin);
53
+ }
51
54
  getFactory() {
52
55
  return ViewFixture.getSharedFactory({
53
56
  namespace: this.namespace,
@@ -16,7 +16,6 @@ import StoreFixture from './fixtures/StoreFixture';
16
16
  import ViewFixture from './fixtures/ViewFixture';
17
17
  export default abstract class AbstractSpruceFixtureTest extends AbstractSkillTest {
18
18
  static fakedPerson: Person;
19
- static fakedClient: MercuryClient;
20
19
  static fakedPeople: Person[];
21
20
  static fakedTeammates: Person[];
22
21
  static fakedOwners: Person[];
@@ -28,6 +27,7 @@ export default abstract class AbstractSpruceFixtureTest extends AbstractSkillTes
28
27
  private static _fakedOrganizations;
29
28
  private static _fakedLocations;
30
29
  static cwd: string;
30
+ static _fakedClient?: MercuryClient;
31
31
  private static _views?;
32
32
  private static _roles?;
33
33
  private static _locations?;
@@ -76,6 +76,8 @@ export default abstract class AbstractSpruceFixtureTest extends AbstractSkillTes
76
76
  executionPromise: Promise<void>;
77
77
  }>;
78
78
  protected static SkillFromTestDir(key: string, options?: SkillFactoryOptions | undefined): Promise<Skill>;
79
+ static get fakedClient(): MercuryClient;
80
+ static set fakedClient(client: MercuryClient);
79
81
  static get fakedOrganizations(): Organization[];
80
82
  static set fakedOrganizations(orgs: Organization[]);
81
83
  static get fakedLocations(): Location[];
@@ -92,6 +92,13 @@ class AbstractSpruceFixtureTest extends spruce_skill_booter_1.AbstractSkillTest
92
92
  this._fixtures = undefined;
93
93
  return skill;
94
94
  }
95
+ static get fakedClient() {
96
+ test_utils_1.assert.isTruthy(this._fakedClient, `You gotta @fake.login() on your test class to get the test client.`);
97
+ return this._fakedClient;
98
+ }
99
+ static set fakedClient(client) {
100
+ this._fakedClient = client;
101
+ }
95
102
  static get fakedOrganizations() {
96
103
  return this._fakedOrganizations;
97
104
  }
@@ -44,6 +44,7 @@ export default class ViewFixture {
44
44
  proxyDecorator: ClientProxyDecorator;
45
45
  permissions: PermissionFixture;
46
46
  });
47
+ addPlugin(name: string, plugin: ViewControllerPlugin): void;
47
48
  getFactory(): ViewControllerFactory;
48
49
  BuildPlugin<P extends ViewControllerPlugin>(Plugin: new (options: ViewControllerPluginOptions) => P): P;
49
50
  getMaps(): import("../../utilities/SpyMapUtil").SpyMapUtil;
@@ -44,6 +44,9 @@ class ViewFixture {
44
44
  organizations: this.orgs,
45
45
  });
46
46
  }
47
+ addPlugin(name, plugin) {
48
+ this.getFactory().addPlugin(name, plugin);
49
+ }
47
50
  getFactory() {
48
51
  return ViewFixture.getSharedFactory({
49
52
  namespace: this.namespace,
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "@sprucelabs/spruce-test-fixtures"
14
14
  ]
15
15
  },
16
- "version": "62.0.129",
16
+ "version": "62.1.0",
17
17
  "files": [
18
18
  "build/**/*",
19
19
  "!build/__tests__",
@@ -71,7 +71,7 @@
71
71
  "@sprucelabs/spruce-core-schemas": "^40.1.38",
72
72
  "@sprucelabs/spruce-event-utils": "^40.0.107",
73
73
  "@sprucelabs/spruce-permission-utils": "^8.0.158",
74
- "@sprucelabs/spruce-skill-booter": "^62.0.129",
74
+ "@sprucelabs/spruce-skill-booter": "^62.1.0",
75
75
  "@sprucelabs/spruce-skill-utils": "^31.0.109",
76
76
  "@sprucelabs/test-utils": "^5.0.85",
77
77
  "dotenv": "^16.4.5",
@@ -114,5 +114,5 @@
114
114
  "^#spruce/(.*)$": "<rootDir>/build/.spruce/$1"
115
115
  }
116
116
  },
117
- "gitHead": "e0e7db647c0fadf55cd0349ab1928d9b8184703b"
117
+ "gitHead": "6c6ca460741c2dbb1a91ed1e3f618fc06505cea2"
118
118
  }