@sprucelabs/spruce-test-fixtures 52.1.4 → 52.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/build/.spruce/errors/options.types.d.ts +1 -1
  2. package/build/ClientProxyDecorator.d.ts +1 -1
  3. package/build/__tests__/behavioral/DummyStore.d.ts +1 -1
  4. package/build/__tests__/support/FakeThemeManager.d.ts +1 -1
  5. package/build/__tests__/test.types.d.ts +1 -1
  6. package/build/__tests__/testDirsAndFiles/one-good-store-skill/build/stores/Good.store.d.ts +1 -1
  7. package/build/esm/.spruce/errors/options.types.d.ts +1 -1
  8. package/build/esm/ClientProxyDecorator.d.ts +1 -1
  9. package/build/esm/__tests__/behavioral/DummyStore.d.ts +1 -1
  10. package/build/esm/__tests__/support/FakeThemeManager.d.ts +1 -1
  11. package/build/esm/__tests__/test.types.d.ts +1 -1
  12. package/build/esm/__tests__/testDirsAndFiles/one-good-store-skill/build/stores/Good.store.d.ts +1 -1
  13. package/build/esm/tests/AbstractSpruceFixtureTest.d.ts +4 -4
  14. package/build/esm/tests/decorators/fake.d.ts +3 -3
  15. package/build/esm/tests/decorators/login.d.ts +1 -1
  16. package/build/esm/tests/decorators/seed.d.ts +4 -4
  17. package/build/esm/tests/eventFaker.d.ts +3 -3
  18. package/build/esm/tests/fixtures/MercuryFixture.js +12 -12
  19. package/build/esm/tests/fixtures/PersonFixture.d.ts +4 -4
  20. package/build/esm/tests/fixtures/RoleFixture.d.ts +1 -1
  21. package/build/esm/tests/fixtures/SeedFixture.d.ts +1 -1
  22. package/build/esm/tests/fixtures/SkillFixture.d.ts +3 -3
  23. package/build/esm/tests/fixtures/ViewFixture.d.ts +2 -2
  24. package/build/esm/tests/fixtures/ViewFixture.js +6 -6
  25. package/build/esm/tests/routers/TestRouter.d.ts +1 -1
  26. package/build/esm/tests/routers/TestRouter.js +3 -3
  27. package/build/esm/types/fixture.types.d.ts +6 -6
  28. package/build/esm/types/view.types.d.ts +1 -1
  29. package/build/esm/utilities/SpyMapUtil.d.ts +1 -1
  30. package/build/tests/AbstractSpruceFixtureTest.d.ts +4 -4
  31. package/build/tests/decorators/fake.d.ts +3 -3
  32. package/build/tests/decorators/login.d.ts +1 -1
  33. package/build/tests/decorators/seed.d.ts +4 -4
  34. package/build/tests/eventFaker.d.ts +3 -3
  35. package/build/tests/fixtures/MercuryFixture.js +12 -12
  36. package/build/tests/fixtures/PersonFixture.d.ts +4 -4
  37. package/build/tests/fixtures/RoleFixture.d.ts +1 -1
  38. package/build/tests/fixtures/SeedFixture.d.ts +1 -1
  39. package/build/tests/fixtures/SkillFixture.d.ts +3 -3
  40. package/build/tests/fixtures/ViewFixture.d.ts +2 -2
  41. package/build/tests/fixtures/ViewFixture.js +6 -6
  42. package/build/tests/routers/TestRouter.d.ts +1 -1
  43. package/build/tests/routers/TestRouter.js +3 -3
  44. package/build/types/fixture.types.d.ts +6 -6
  45. package/build/types/view.types.d.ts +1 -1
  46. package/build/utilities/SpyMapUtil.d.ts +1 -1
  47. package/package.json +3 -3
@@ -24,5 +24,5 @@ export interface InvalidFixtureErrorOptions extends SpruceErrors.SpruceTestFixtu
24
24
  export interface FakeEventErrorErrorOptions extends SpruceErrors.SpruceTestFixtures.FakeEventError, ISpruceErrorOptions {
25
25
  code: 'FAKE_EVENT_ERROR';
26
26
  }
27
- declare type ErrorOptions = UnknownViewControllerErrorErrorOptions | SkillNotFoundErrorOptions | ScopeRequirementsNotMetErrorOptions | NotFoundErrorOptions | InvalidViewControllerErrorOptions | InvalidTargetErrorOptions | InvalidFixtureErrorOptions | FakeEventErrorErrorOptions;
27
+ type ErrorOptions = UnknownViewControllerErrorErrorOptions | SkillNotFoundErrorOptions | ScopeRequirementsNotMetErrorOptions | NotFoundErrorOptions | InvalidViewControllerErrorOptions | InvalidTargetErrorOptions | InvalidFixtureErrorOptions | FakeEventErrorErrorOptions;
28
28
  export default ErrorOptions;
@@ -1,5 +1,5 @@
1
1
  import { MercuryClient } from '@sprucelabs/mercury-client';
2
- export declare type TokenGenerator = () => undefined | string | Promise<string | undefined>;
2
+ export type TokenGenerator = () => undefined | string | Promise<string | undefined>;
3
3
  export default class ClientProxyDecorator {
4
4
  private static instance?;
5
5
  private proxyTokenGenerator?;
@@ -9,7 +9,7 @@ declare const dummySchema: {
9
9
  };
10
10
  };
11
11
  };
12
- declare type DummySchema = typeof dummySchema;
12
+ type DummySchema = typeof dummySchema;
13
13
  export declare class DummyStore extends AbstractStore<DummySchema> {
14
14
  name: string;
15
15
  protected collectionName: string;
@@ -1,5 +1,5 @@
1
1
  import { SpruceSchemas, ThemeManager } from '@sprucelabs/heartwood-view-controllers';
2
- declare type Theme = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Theme;
2
+ type Theme = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Theme;
3
3
  export default class FakeThemeManager implements ThemeManager {
4
4
  private theme;
5
5
  setTheme(theme: Theme): void;
@@ -1,2 +1,2 @@
1
1
  import { SpruceSchemas } from '@sprucelabs/mercury-types';
2
- export declare type Organization = SpruceSchemas.Spruce.v2020_07_22.Organization;
2
+ export type Organization = SpruceSchemas.Spruce.v2020_07_22.Organization;
@@ -8,7 +8,7 @@ declare const fullSchema: {
8
8
  };
9
9
  };
10
10
  };
11
- declare type FullSchema = typeof fullSchema;
11
+ type FullSchema = typeof fullSchema;
12
12
  export default class GoodStore extends AbstractStore<FullSchema> {
13
13
  name: string;
14
14
  protected collectionName: string;
@@ -24,5 +24,5 @@ export interface InvalidFixtureErrorOptions extends SpruceErrors.SpruceTestFixtu
24
24
  export interface FakeEventErrorErrorOptions extends SpruceErrors.SpruceTestFixtures.FakeEventError, ISpruceErrorOptions {
25
25
  code: 'FAKE_EVENT_ERROR';
26
26
  }
27
- declare type ErrorOptions = UnknownViewControllerErrorErrorOptions | SkillNotFoundErrorOptions | ScopeRequirementsNotMetErrorOptions | NotFoundErrorOptions | InvalidViewControllerErrorOptions | InvalidTargetErrorOptions | InvalidFixtureErrorOptions | FakeEventErrorErrorOptions;
27
+ type ErrorOptions = UnknownViewControllerErrorErrorOptions | SkillNotFoundErrorOptions | ScopeRequirementsNotMetErrorOptions | NotFoundErrorOptions | InvalidViewControllerErrorOptions | InvalidTargetErrorOptions | InvalidFixtureErrorOptions | FakeEventErrorErrorOptions;
28
28
  export default ErrorOptions;
@@ -1,5 +1,5 @@
1
1
  import { MercuryClient } from '@sprucelabs/mercury-client';
2
- export declare type TokenGenerator = () => undefined | string | Promise<string | undefined>;
2
+ export type TokenGenerator = () => undefined | string | Promise<string | undefined>;
3
3
  export default class ClientProxyDecorator {
4
4
  private static instance?;
5
5
  private proxyTokenGenerator?;
@@ -9,7 +9,7 @@ declare const dummySchema: {
9
9
  };
10
10
  };
11
11
  };
12
- declare type DummySchema = typeof dummySchema;
12
+ type DummySchema = typeof dummySchema;
13
13
  export declare class DummyStore extends AbstractStore<DummySchema> {
14
14
  name: string;
15
15
  protected collectionName: string;
@@ -1,5 +1,5 @@
1
1
  import { SpruceSchemas, ThemeManager } from '@sprucelabs/heartwood-view-controllers';
2
- declare type Theme = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Theme;
2
+ type Theme = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Theme;
3
3
  export default class FakeThemeManager implements ThemeManager {
4
4
  private theme;
5
5
  setTheme(theme: Theme): void;
@@ -1,2 +1,2 @@
1
1
  import { SpruceSchemas } from '@sprucelabs/mercury-types';
2
- export declare type Organization = SpruceSchemas.Spruce.v2020_07_22.Organization;
2
+ export type Organization = SpruceSchemas.Spruce.v2020_07_22.Organization;
@@ -8,7 +8,7 @@ declare const fullSchema: {
8
8
  };
9
9
  };
10
10
  };
11
- declare type FullSchema = typeof fullSchema;
11
+ type FullSchema = typeof fullSchema;
12
12
  export default class GoodStore extends AbstractStore<FullSchema> {
13
13
  name: string;
14
14
  protected collectionName: string;
@@ -12,10 +12,10 @@ import SeedFixture from './fixtures/SeedFixture';
12
12
  import SkillFixture from './fixtures/SkillFixture';
13
13
  import StoreFixture from './fixtures/StoreFixture';
14
14
  import ViewFixture from './fixtures/ViewFixture';
15
- declare type Person = SpruceSchemas.Spruce.v2020_07_22.Person;
16
- declare type Role = SpruceSchemas.Spruce.v2020_07_22.Role;
17
- declare type Skill = SpruceSchemas.Spruce.v2020_07_22.Skill;
18
- declare type Organization = SpruceSchemas.Spruce.v2020_07_22.Organization;
15
+ type Person = SpruceSchemas.Spruce.v2020_07_22.Person;
16
+ type Role = SpruceSchemas.Spruce.v2020_07_22.Role;
17
+ type Skill = SpruceSchemas.Spruce.v2020_07_22.Skill;
18
+ type Organization = SpruceSchemas.Spruce.v2020_07_22.Organization;
19
19
  export default abstract class AbstractSpruceFixtureTest extends AbstractSkillTest {
20
20
  static fakedPerson: Person;
21
21
  static fakedClient: MercuryClient;
@@ -1,10 +1,10 @@
1
1
  import { MercuryClient } from '@sprucelabs/mercury-client';
2
2
  import { SpruceSchemas } from '@sprucelabs/mercury-types';
3
3
  import { CoreSeedTarget } from './seed';
4
- declare type Person = SpruceSchemas.Spruce.v2020_07_22.Person;
5
- declare type Skill = SpruceSchemas.Spruce.v2020_07_22.Skill;
4
+ type Person = SpruceSchemas.Spruce.v2020_07_22.Person;
5
+ type Skill = SpruceSchemas.Spruce.v2020_07_22.Skill;
6
6
  /** @ts-ignore */
7
- declare type Client = MercuryClient;
7
+ type Client = MercuryClient;
8
8
  interface ClassWithFakes {
9
9
  fakedOwners?: Person[];
10
10
  fakedTeammates?: Person[];
@@ -1,6 +1,6 @@
1
1
  import { MercuryClient } from '@sprucelabs/mercury-client';
2
2
  import { SpruceSchemas } from '@sprucelabs/mercury-types';
3
- declare type Client = MercuryClient;
3
+ type Client = MercuryClient;
4
4
  declare function login(phone: string): (Class: any) => void;
5
5
  declare namespace login {
6
6
  var getClient: () => Client;
@@ -1,9 +1,9 @@
1
1
  import { StoreName } from '@sprucelabs/data-stores';
2
2
  import { EMPLOYED_BASE_ROLES, GUEST_BASE_ROLES } from '@sprucelabs/spruce-core-schemas';
3
- declare type EMPLOYED = typeof EMPLOYED_BASE_ROLES;
4
- declare type GUEST = typeof GUEST_BASE_ROLES;
5
- export declare type CoreSeedTarget = 'organizations' | 'locations' | `${EMPLOYED[number]['slug']}s` | `${GUEST[number]['slug']}s`;
6
- declare type SeedTarget = CoreSeedTarget | StoreName;
3
+ type EMPLOYED = typeof EMPLOYED_BASE_ROLES;
4
+ type GUEST = typeof GUEST_BASE_ROLES;
5
+ export type CoreSeedTarget = 'organizations' | 'locations' | `${EMPLOYED[number]['slug']}s` | `${GUEST[number]['slug']}s`;
6
+ type SeedTarget = CoreSeedTarget | StoreName;
7
7
  declare function seed(storeName: SeedTarget, totalToSeed?: number, ...params: any[]): (Class: any, key: string, descriptor: any) => void;
8
8
  declare namespace seed {
9
9
  var disableResettingTestClient: () => void;
@@ -1,11 +1,11 @@
1
1
  import { SkillEventContract } from '@sprucelabs/mercury-types';
2
2
  import { SchemaValues } from '@sprucelabs/schema';
3
3
  /** @ts-ignore */
4
- declare type Fqen = keyof SkillEventContract['eventSignatures'];
5
- declare type TargetAndPayload<E extends Fqen> = SchemaValues<
4
+ type Fqen = keyof SkillEventContract['eventSignatures'];
5
+ type TargetAndPayload<E extends Fqen> = SchemaValues<
6
6
  /** @ts-ignore */
7
7
  SkillEventContract['eventSignatures'][E]['emitPayloadSchema']>;
8
- declare type Response<E extends Fqen> = SchemaValues<
8
+ type Response<E extends Fqen> = SchemaValues<
9
9
  /** @ts-ignore> */
10
10
  SkillEventContract['eventSignatures'][E]['responsePayloadSchema']>;
11
11
  declare const eventFaker: {
@@ -18,18 +18,6 @@ const env = require('dotenv');
18
18
  env.config();
19
19
  const TEST_HOST = (_a = process.env.TEST_HOST) !== null && _a !== void 0 ? _a : process.env.HOST;
20
20
  export default class MercuryFixture {
21
- constructor(cwd) {
22
- this.clientPromises = [];
23
- this.cwd = cwd;
24
- if (!this.cwd) {
25
- throw new SchemaError({
26
- code: 'MISSING_PARAMETERS',
27
- friendlyMessage: 'Mercury fixture needs cwd.',
28
- parameters: ['options.cwd'],
29
- });
30
- }
31
- this.connectToApi = this.connectToApi.bind(this);
32
- }
33
21
  static setDefaultClient(client) {
34
22
  //@ts-ignore
35
23
  client.shouldDestroy = this.shouldAutomaticallyClearDefaultClient;
@@ -44,6 +32,18 @@ export default class MercuryFixture {
44
32
  static setShouldAutomaticallyClearDefaultClient(shouldClear) {
45
33
  this.shouldAutomaticallyClearDefaultClient = shouldClear;
46
34
  }
35
+ constructor(cwd) {
36
+ this.clientPromises = [];
37
+ this.cwd = cwd;
38
+ if (!this.cwd) {
39
+ throw new SchemaError({
40
+ code: 'MISSING_PARAMETERS',
41
+ friendlyMessage: 'Mercury fixture needs cwd.',
42
+ parameters: ['options.cwd'],
43
+ });
44
+ }
45
+ this.connectToApi = this.connectToApi.bind(this);
46
+ }
47
47
  connectToApi(options) {
48
48
  return __awaiter(this, void 0, void 0, function* () {
49
49
  const shouldReUseClient = (options === null || options === void 0 ? void 0 : options.shouldReUseClient) !== false;
@@ -1,10 +1,10 @@
1
1
  import { MercuryClient } from '@sprucelabs/mercury-client';
2
2
  import { SpruceSchemas } from '@sprucelabs/spruce-core-schemas';
3
3
  import { TestConnectFactory } from '../../types/fixture.types';
4
- declare type Person = SpruceSchemas.Spruce.v2020_07_22.Person;
5
- declare type Factory = TestConnectFactory;
6
- declare type ClientPromise = ReturnType<Factory>;
7
- declare type Client = ClientPromise extends PromiseLike<infer C> ? C : ClientPromise;
4
+ type Person = SpruceSchemas.Spruce.v2020_07_22.Person;
5
+ type Factory = TestConnectFactory;
6
+ type ClientPromise = ReturnType<Factory>;
7
+ type Client = ClientPromise extends PromiseLike<infer C> ? C : ClientPromise;
8
8
  export default class PersonFixture {
9
9
  private connectToApi;
10
10
  private lastLoggedIn?;
@@ -1,6 +1,6 @@
1
1
  import { SpruceSchemas } from '@sprucelabs/mercury-types';
2
2
  import PersonFixture from './PersonFixture';
3
- declare type GetNewestOrgHandler = () => Promise<SpruceSchemas.Spruce.v2020_07_22.Organization | null>;
3
+ type GetNewestOrgHandler = () => Promise<SpruceSchemas.Spruce.v2020_07_22.Organization | null>;
4
4
  export default class RoleFixture {
5
5
  private personFixture;
6
6
  private getNewestOrgHandler;
@@ -2,7 +2,7 @@ import { SpruceSchemas } from '@sprucelabs/mercury-types';
2
2
  import LocationFixture from './LocationFixture';
3
3
  import OrganizationFixture from './OrganizationFixture';
4
4
  import PersonFixture from './PersonFixture';
5
- declare type Person = SpruceSchemas.Spruce.v2020_07_22.Person;
5
+ type Person = SpruceSchemas.Spruce.v2020_07_22.Person;
6
6
  export interface SeedLocationOptions {
7
7
  totalLocations: number;
8
8
  organizationId?: string;
@@ -2,9 +2,9 @@ import { MercuryClient } from '@sprucelabs/mercury-client';
2
2
  import { SpruceSchemas } from '@sprucelabs/spruce-core-schemas';
3
3
  import { TestConnectFactory } from '../../types/fixture.types';
4
4
  import PersonFixture from './PersonFixture';
5
- declare type Skill = SpruceSchemas.Spruce.v2020_07_22.Skill;
6
- declare type Factory = TestConnectFactory;
7
- declare type Client = MercuryClient;
5
+ type Skill = SpruceSchemas.Spruce.v2020_07_22.Skill;
6
+ type Factory = TestConnectFactory;
7
+ type Client = MercuryClient;
8
8
  export interface SeedDemoSkillValues {
9
9
  name?: string;
10
10
  slug?: string;
@@ -11,8 +11,8 @@ import SpyAuthorizer from '../SpyAuthorizer';
11
11
  import FixtureFactory from './FixtureFactory';
12
12
  import PersonFixture from './PersonFixture';
13
13
  import SpyScope from './SpyScope';
14
- declare type Factory = TestConnectFactory;
15
- declare type Client = MercuryClient;
14
+ type Factory = TestConnectFactory;
15
+ type Client = MercuryClient;
16
16
  export default class ViewFixture {
17
17
  private static vcFactory?;
18
18
  private static loggedInPersonProxyTokens;
@@ -20,6 +20,12 @@ import TestRouter from '../routers/TestRouter.js';
20
20
  import SpyAuthorizer from '../SpyAuthorizer.js';
21
21
  import SpyScope from './SpyScope.js';
22
22
  export default class ViewFixture {
23
+ static lockProxyCacheForPerson(id) {
24
+ this.dontResetProxyTokenForPersonId = id;
25
+ }
26
+ static setShouldAutomaticallyResetAuth(shouldReset) {
27
+ this.shouldAutomaticallyResetAuthenticator = shouldReset;
28
+ }
23
29
  constructor(options) {
24
30
  var _a, _b;
25
31
  this.connectToApi = options.connectToApi;
@@ -38,12 +44,6 @@ export default class ViewFixture {
38
44
  organizations: this.orgs,
39
45
  });
40
46
  }
41
- static lockProxyCacheForPerson(id) {
42
- this.dontResetProxyTokenForPersonId = id;
43
- }
44
- static setShouldAutomaticallyResetAuth(shouldReset) {
45
- this.shouldAutomaticallyResetAuthenticator = shouldReset;
46
- }
47
47
  getFactory() {
48
48
  return ViewFixture.getSharedFactory({
49
49
  namespace: this.namespace,
@@ -10,7 +10,7 @@ declare const contract: {
10
10
  };
11
11
  };
12
12
  };
13
- declare type Contract = typeof contract;
13
+ type Contract = typeof contract;
14
14
  export default class TestRouter extends AbstractEventEmitter<Contract> implements Router, MercuryEventEmitter<Contract> {
15
15
  private vcFactory;
16
16
  private presentVc?;
@@ -21,6 +21,9 @@ const contract = buildEventContract({
21
21
  },
22
22
  });
23
23
  export default class TestRouter extends AbstractEventEmitter {
24
+ static setShouldThrowWhenRedirectingToBadSvc(shouldThrow) {
25
+ this.shouldThrowWhenRedirectingToBadSvc = shouldThrow;
26
+ }
24
27
  constructor(options) {
25
28
  super(contract);
26
29
  this.themes = new FakeThemeManager();
@@ -28,9 +31,6 @@ export default class TestRouter extends AbstractEventEmitter {
28
31
  this.scope = options.scope;
29
32
  this.locale = options.locale;
30
33
  }
31
- static setShouldThrowWhenRedirectingToBadSvc(shouldThrow) {
32
- this.shouldThrowWhenRedirectingToBadSvc = shouldThrow;
33
- }
34
34
  static setShouldLoadDestinationVc(shouldLoad) {
35
35
  this.shouldLoadDestinationVc = shouldLoad;
36
36
  }
@@ -14,8 +14,8 @@ import ViewFixture from '../tests/fixtures/ViewFixture';
14
14
  export interface TestConnectionOptions {
15
15
  shouldReUseClient?: boolean;
16
16
  }
17
- export declare type ConnectOptions = TestConnectionOptions & ConnectionOptions;
18
- export declare type TestConnectFactory = (options?: ConnectOptions) => Promise<MercuryClient>;
17
+ export type ConnectOptions = TestConnectionOptions & ConnectionOptions;
18
+ export type TestConnectFactory = (options?: ConnectOptions) => Promise<MercuryClient>;
19
19
  export interface FixtureClassMap {
20
20
  person: typeof PersonFixture;
21
21
  organization: typeof OrganizationFixture;
@@ -28,14 +28,14 @@ export interface FixtureClassMap {
28
28
  role: typeof RoleFixture;
29
29
  seed: typeof SeedFixture;
30
30
  }
31
- export declare type RoleBase = NonNullable<SpruceSchemas.Spruce.v2020_07_22.Role['base']>;
32
- export declare type FixtureMap = {
31
+ export type RoleBase = NonNullable<SpruceSchemas.Spruce.v2020_07_22.Role['base']>;
32
+ export type FixtureMap = {
33
33
  [K in keyof FixtureClassMap]: InstanceType<FixtureClassMap[K]>;
34
34
  };
35
- export declare type FixtureConstructorOptionsMap = {
35
+ export type FixtureConstructorOptionsMap = {
36
36
  [K in keyof FixtureClassMap]: ConstructorParameters<FixtureClassMap[K]>[0];
37
37
  };
38
- export declare type FixtureName = keyof FixtureMap;
38
+ export type FixtureName = keyof FixtureMap;
39
39
  declare module '@sprucelabs/heartwood-view-controllers/build/types/heartwood.types' {
40
40
  interface SkillViewControllerMap {
41
41
  'heartwood.root': FakeSkillViewController;
@@ -9,7 +9,7 @@ export interface ViewHealthCheckItem extends HealthCheckItem {
9
9
  viewControllers: HealthCheckView[];
10
10
  skillViewControllers: HealthCheckView[];
11
11
  }
12
- export declare type ArgsFromSvc<T> = T extends SkillViewController<infer R> ? R : Record<string, any>;
12
+ export type ArgsFromSvc<T> = T extends SkillViewController<infer R> ? R : Record<string, any>;
13
13
  declare module '@sprucelabs/spruce-skill-utils/build/types/skill.types' {
14
14
  interface HealthCheckResults {
15
15
  view?: ViewHealthCheckItem;
@@ -1,5 +1,5 @@
1
1
  import { MapUtil, OpenNavigationOptions } from '@sprucelabs/heartwood-view-controllers';
2
- export declare type SpyMapUtil = MapUtil & {
2
+ export type SpyMapUtil = MapUtil & {
3
3
  lastOpenNavigationOptions: OpenNavigationOptions | undefined;
4
4
  };
5
5
  declare const spyMapUtil: SpyMapUtil;
@@ -12,10 +12,10 @@ import SeedFixture from './fixtures/SeedFixture';
12
12
  import SkillFixture from './fixtures/SkillFixture';
13
13
  import StoreFixture from './fixtures/StoreFixture';
14
14
  import ViewFixture from './fixtures/ViewFixture';
15
- declare type Person = SpruceSchemas.Spruce.v2020_07_22.Person;
16
- declare type Role = SpruceSchemas.Spruce.v2020_07_22.Role;
17
- declare type Skill = SpruceSchemas.Spruce.v2020_07_22.Skill;
18
- declare type Organization = SpruceSchemas.Spruce.v2020_07_22.Organization;
15
+ type Person = SpruceSchemas.Spruce.v2020_07_22.Person;
16
+ type Role = SpruceSchemas.Spruce.v2020_07_22.Role;
17
+ type Skill = SpruceSchemas.Spruce.v2020_07_22.Skill;
18
+ type Organization = SpruceSchemas.Spruce.v2020_07_22.Organization;
19
19
  export default abstract class AbstractSpruceFixtureTest extends AbstractSkillTest {
20
20
  static fakedPerson: Person;
21
21
  static fakedClient: MercuryClient;
@@ -1,10 +1,10 @@
1
1
  import { MercuryClient } from '@sprucelabs/mercury-client';
2
2
  import { SpruceSchemas } from '@sprucelabs/mercury-types';
3
3
  import { CoreSeedTarget } from './seed';
4
- declare type Person = SpruceSchemas.Spruce.v2020_07_22.Person;
5
- declare type Skill = SpruceSchemas.Spruce.v2020_07_22.Skill;
4
+ type Person = SpruceSchemas.Spruce.v2020_07_22.Person;
5
+ type Skill = SpruceSchemas.Spruce.v2020_07_22.Skill;
6
6
  /** @ts-ignore */
7
- declare type Client = MercuryClient;
7
+ type Client = MercuryClient;
8
8
  interface ClassWithFakes {
9
9
  fakedOwners?: Person[];
10
10
  fakedTeammates?: Person[];
@@ -1,6 +1,6 @@
1
1
  import { MercuryClient } from '@sprucelabs/mercury-client';
2
2
  import { SpruceSchemas } from '@sprucelabs/mercury-types';
3
- declare type Client = MercuryClient;
3
+ type Client = MercuryClient;
4
4
  declare function login(phone: string): (Class: any) => void;
5
5
  declare namespace login {
6
6
  var getClient: () => Client;
@@ -1,9 +1,9 @@
1
1
  import { StoreName } from '@sprucelabs/data-stores';
2
2
  import { EMPLOYED_BASE_ROLES, GUEST_BASE_ROLES } from '@sprucelabs/spruce-core-schemas';
3
- declare type EMPLOYED = typeof EMPLOYED_BASE_ROLES;
4
- declare type GUEST = typeof GUEST_BASE_ROLES;
5
- export declare type CoreSeedTarget = 'organizations' | 'locations' | `${EMPLOYED[number]['slug']}s` | `${GUEST[number]['slug']}s`;
6
- declare type SeedTarget = CoreSeedTarget | StoreName;
3
+ type EMPLOYED = typeof EMPLOYED_BASE_ROLES;
4
+ type GUEST = typeof GUEST_BASE_ROLES;
5
+ export type CoreSeedTarget = 'organizations' | 'locations' | `${EMPLOYED[number]['slug']}s` | `${GUEST[number]['slug']}s`;
6
+ type SeedTarget = CoreSeedTarget | StoreName;
7
7
  declare function seed(storeName: SeedTarget, totalToSeed?: number, ...params: any[]): (Class: any, key: string, descriptor: any) => void;
8
8
  declare namespace seed {
9
9
  var disableResettingTestClient: () => void;
@@ -1,11 +1,11 @@
1
1
  import { SkillEventContract } from '@sprucelabs/mercury-types';
2
2
  import { SchemaValues } from '@sprucelabs/schema';
3
3
  /** @ts-ignore */
4
- declare type Fqen = keyof SkillEventContract['eventSignatures'];
5
- declare type TargetAndPayload<E extends Fqen> = SchemaValues<
4
+ type Fqen = keyof SkillEventContract['eventSignatures'];
5
+ type TargetAndPayload<E extends Fqen> = SchemaValues<
6
6
  /** @ts-ignore */
7
7
  SkillEventContract['eventSignatures'][E]['emitPayloadSchema']>;
8
- declare type Response<E extends Fqen> = SchemaValues<
8
+ type Response<E extends Fqen> = SchemaValues<
9
9
  /** @ts-ignore> */
10
10
  SkillEventContract['eventSignatures'][E]['responsePayloadSchema']>;
11
11
  declare const eventFaker: {
@@ -11,18 +11,6 @@ const env = require('dotenv');
11
11
  env.config();
12
12
  const TEST_HOST = (_a = process.env.TEST_HOST) !== null && _a !== void 0 ? _a : process.env.HOST;
13
13
  class MercuryFixture {
14
- constructor(cwd) {
15
- this.clientPromises = [];
16
- this.cwd = cwd;
17
- if (!this.cwd) {
18
- throw new schema_1.SchemaError({
19
- code: 'MISSING_PARAMETERS',
20
- friendlyMessage: 'Mercury fixture needs cwd.',
21
- parameters: ['options.cwd'],
22
- });
23
- }
24
- this.connectToApi = this.connectToApi.bind(this);
25
- }
26
14
  static setDefaultClient(client) {
27
15
  //@ts-ignore
28
16
  client.shouldDestroy = this.shouldAutomaticallyClearDefaultClient;
@@ -37,6 +25,18 @@ class MercuryFixture {
37
25
  static setShouldAutomaticallyClearDefaultClient(shouldClear) {
38
26
  this.shouldAutomaticallyClearDefaultClient = shouldClear;
39
27
  }
28
+ constructor(cwd) {
29
+ this.clientPromises = [];
30
+ this.cwd = cwd;
31
+ if (!this.cwd) {
32
+ throw new schema_1.SchemaError({
33
+ code: 'MISSING_PARAMETERS',
34
+ friendlyMessage: 'Mercury fixture needs cwd.',
35
+ parameters: ['options.cwd'],
36
+ });
37
+ }
38
+ this.connectToApi = this.connectToApi.bind(this);
39
+ }
40
40
  async connectToApi(options) {
41
41
  const shouldReUseClient = (options === null || options === void 0 ? void 0 : options.shouldReUseClient) !== false;
42
42
  if (shouldReUseClient && MercuryFixture.defaultClient) {
@@ -1,10 +1,10 @@
1
1
  import { MercuryClient } from '@sprucelabs/mercury-client';
2
2
  import { SpruceSchemas } from '@sprucelabs/spruce-core-schemas';
3
3
  import { TestConnectFactory } from '../../types/fixture.types';
4
- declare type Person = SpruceSchemas.Spruce.v2020_07_22.Person;
5
- declare type Factory = TestConnectFactory;
6
- declare type ClientPromise = ReturnType<Factory>;
7
- declare type Client = ClientPromise extends PromiseLike<infer C> ? C : ClientPromise;
4
+ type Person = SpruceSchemas.Spruce.v2020_07_22.Person;
5
+ type Factory = TestConnectFactory;
6
+ type ClientPromise = ReturnType<Factory>;
7
+ type Client = ClientPromise extends PromiseLike<infer C> ? C : ClientPromise;
8
8
  export default class PersonFixture {
9
9
  private connectToApi;
10
10
  private lastLoggedIn?;
@@ -1,6 +1,6 @@
1
1
  import { SpruceSchemas } from '@sprucelabs/mercury-types';
2
2
  import PersonFixture from './PersonFixture';
3
- declare type GetNewestOrgHandler = () => Promise<SpruceSchemas.Spruce.v2020_07_22.Organization | null>;
3
+ type GetNewestOrgHandler = () => Promise<SpruceSchemas.Spruce.v2020_07_22.Organization | null>;
4
4
  export default class RoleFixture {
5
5
  private personFixture;
6
6
  private getNewestOrgHandler;
@@ -2,7 +2,7 @@ import { SpruceSchemas } from '@sprucelabs/mercury-types';
2
2
  import LocationFixture from './LocationFixture';
3
3
  import OrganizationFixture from './OrganizationFixture';
4
4
  import PersonFixture from './PersonFixture';
5
- declare type Person = SpruceSchemas.Spruce.v2020_07_22.Person;
5
+ type Person = SpruceSchemas.Spruce.v2020_07_22.Person;
6
6
  export interface SeedLocationOptions {
7
7
  totalLocations: number;
8
8
  organizationId?: string;
@@ -2,9 +2,9 @@ import { MercuryClient } from '@sprucelabs/mercury-client';
2
2
  import { SpruceSchemas } from '@sprucelabs/spruce-core-schemas';
3
3
  import { TestConnectFactory } from '../../types/fixture.types';
4
4
  import PersonFixture from './PersonFixture';
5
- declare type Skill = SpruceSchemas.Spruce.v2020_07_22.Skill;
6
- declare type Factory = TestConnectFactory;
7
- declare type Client = MercuryClient;
5
+ type Skill = SpruceSchemas.Spruce.v2020_07_22.Skill;
6
+ type Factory = TestConnectFactory;
7
+ type Client = MercuryClient;
8
8
  export interface SeedDemoSkillValues {
9
9
  name?: string;
10
10
  slug?: string;
@@ -11,8 +11,8 @@ import SpyAuthorizer from '../SpyAuthorizer';
11
11
  import FixtureFactory from './FixtureFactory';
12
12
  import PersonFixture from './PersonFixture';
13
13
  import SpyScope from './SpyScope';
14
- declare type Factory = TestConnectFactory;
15
- declare type Client = MercuryClient;
14
+ type Factory = TestConnectFactory;
15
+ type Client = MercuryClient;
16
16
  export default class ViewFixture {
17
17
  private static vcFactory?;
18
18
  private static loggedInPersonProxyTokens;
@@ -16,6 +16,12 @@ const TestRouter_1 = __importDefault(require("../routers/TestRouter"));
16
16
  const SpyAuthorizer_1 = __importDefault(require("../SpyAuthorizer"));
17
17
  const SpyScope_1 = __importDefault(require("./SpyScope"));
18
18
  class ViewFixture {
19
+ static lockProxyCacheForPerson(id) {
20
+ this.dontResetProxyTokenForPersonId = id;
21
+ }
22
+ static setShouldAutomaticallyResetAuth(shouldReset) {
23
+ this.shouldAutomaticallyResetAuthenticator = shouldReset;
24
+ }
19
25
  constructor(options) {
20
26
  var _a, _b;
21
27
  this.connectToApi = options.connectToApi;
@@ -34,12 +40,6 @@ class ViewFixture {
34
40
  organizations: this.orgs,
35
41
  });
36
42
  }
37
- static lockProxyCacheForPerson(id) {
38
- this.dontResetProxyTokenForPersonId = id;
39
- }
40
- static setShouldAutomaticallyResetAuth(shouldReset) {
41
- this.shouldAutomaticallyResetAuthenticator = shouldReset;
42
- }
43
43
  getFactory() {
44
44
  return ViewFixture.getSharedFactory({
45
45
  namespace: this.namespace,
@@ -10,7 +10,7 @@ declare const contract: {
10
10
  };
11
11
  };
12
12
  };
13
- declare type Contract = typeof contract;
13
+ type Contract = typeof contract;
14
14
  export default class TestRouter extends AbstractEventEmitter<Contract> implements Router, MercuryEventEmitter<Contract> {
15
15
  private vcFactory;
16
16
  private presentVc?;
@@ -17,6 +17,9 @@ const contract = (0, mercury_types_1.buildEventContract)({
17
17
  },
18
18
  });
19
19
  class TestRouter extends mercury_event_emitter_1.AbstractEventEmitter {
20
+ static setShouldThrowWhenRedirectingToBadSvc(shouldThrow) {
21
+ this.shouldThrowWhenRedirectingToBadSvc = shouldThrow;
22
+ }
20
23
  constructor(options) {
21
24
  super(contract);
22
25
  this.themes = new FakeThemeManager_1.default();
@@ -24,9 +27,6 @@ class TestRouter extends mercury_event_emitter_1.AbstractEventEmitter {
24
27
  this.scope = options.scope;
25
28
  this.locale = options.locale;
26
29
  }
27
- static setShouldThrowWhenRedirectingToBadSvc(shouldThrow) {
28
- this.shouldThrowWhenRedirectingToBadSvc = shouldThrow;
29
- }
30
30
  static setShouldLoadDestinationVc(shouldLoad) {
31
31
  this.shouldLoadDestinationVc = shouldLoad;
32
32
  }
@@ -14,8 +14,8 @@ import ViewFixture from '../tests/fixtures/ViewFixture';
14
14
  export interface TestConnectionOptions {
15
15
  shouldReUseClient?: boolean;
16
16
  }
17
- export declare type ConnectOptions = TestConnectionOptions & ConnectionOptions;
18
- export declare type TestConnectFactory = (options?: ConnectOptions) => Promise<MercuryClient>;
17
+ export type ConnectOptions = TestConnectionOptions & ConnectionOptions;
18
+ export type TestConnectFactory = (options?: ConnectOptions) => Promise<MercuryClient>;
19
19
  export interface FixtureClassMap {
20
20
  person: typeof PersonFixture;
21
21
  organization: typeof OrganizationFixture;
@@ -28,14 +28,14 @@ export interface FixtureClassMap {
28
28
  role: typeof RoleFixture;
29
29
  seed: typeof SeedFixture;
30
30
  }
31
- export declare type RoleBase = NonNullable<SpruceSchemas.Spruce.v2020_07_22.Role['base']>;
32
- export declare type FixtureMap = {
31
+ export type RoleBase = NonNullable<SpruceSchemas.Spruce.v2020_07_22.Role['base']>;
32
+ export type FixtureMap = {
33
33
  [K in keyof FixtureClassMap]: InstanceType<FixtureClassMap[K]>;
34
34
  };
35
- export declare type FixtureConstructorOptionsMap = {
35
+ export type FixtureConstructorOptionsMap = {
36
36
  [K in keyof FixtureClassMap]: ConstructorParameters<FixtureClassMap[K]>[0];
37
37
  };
38
- export declare type FixtureName = keyof FixtureMap;
38
+ export type FixtureName = keyof FixtureMap;
39
39
  declare module '@sprucelabs/heartwood-view-controllers/build/types/heartwood.types' {
40
40
  interface SkillViewControllerMap {
41
41
  'heartwood.root': FakeSkillViewController;
@@ -9,7 +9,7 @@ export interface ViewHealthCheckItem extends HealthCheckItem {
9
9
  viewControllers: HealthCheckView[];
10
10
  skillViewControllers: HealthCheckView[];
11
11
  }
12
- export declare type ArgsFromSvc<T> = T extends SkillViewController<infer R> ? R : Record<string, any>;
12
+ export type ArgsFromSvc<T> = T extends SkillViewController<infer R> ? R : Record<string, any>;
13
13
  declare module '@sprucelabs/spruce-skill-utils/build/types/skill.types' {
14
14
  interface HealthCheckResults {
15
15
  view?: ViewHealthCheckItem;
@@ -1,5 +1,5 @@
1
1
  import { MapUtil, OpenNavigationOptions } from '@sprucelabs/heartwood-view-controllers';
2
- export declare type SpyMapUtil = MapUtil & {
2
+ export type SpyMapUtil = MapUtil & {
3
3
  lastOpenNavigationOptions: OpenNavigationOptions | undefined;
4
4
  };
5
5
  declare const spyMapUtil: SpyMapUtil;
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "@sprucelabs/spruce-test-fixtures"
14
14
  ]
15
15
  },
16
- "version": "52.1.4",
16
+ "version": "52.2.0",
17
17
  "files": [
18
18
  "build/**/*",
19
19
  "!build/__tests__",
@@ -71,7 +71,7 @@
71
71
  "@sprucelabs/schema": "^28.5.66",
72
72
  "@sprucelabs/spruce-core-schemas": "^35.1.55",
73
73
  "@sprucelabs/spruce-event-utils": "^29.1.58",
74
- "@sprucelabs/spruce-skill-booter": "^52.1.4",
74
+ "@sprucelabs/spruce-skill-booter": "^52.2.0",
75
75
  "@sprucelabs/spruce-skill-utils": "^28.0.50",
76
76
  "@sprucelabs/test-utils": "^3.2.54",
77
77
  "dotenv": "^16.0.3",
@@ -131,5 +131,5 @@
131
131
  ]
132
132
  ]
133
133
  },
134
- "gitHead": "db82497db196160911f08646a10caef2d257e0e7"
134
+ "gitHead": "2b3162f292988316d9fa455fa48b1a03d4390de6"
135
135
  }