@sprucelabs/spruce-location-utils 3.1.21 → 3.2.2

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.
@@ -0,0 +1,24 @@
1
+ import { SkillViewController } from '@sprucelabs/heartwood-view-controllers';
2
+ import { OrganizationFixture, ViewFixture } from '@sprucelabs/spruce-test-fixtures';
3
+ declare const organizationAssert: {
4
+ /**
5
+ *
6
+ * @deprecated use vcAssert.assertSkillViewIsScopedBy(this.vc, 'organization')
7
+ */
8
+ assertRedirectsToAddOrgIfNoOrgExists(options: {
9
+ views: ViewFixture;
10
+ organizations: OrganizationFixture;
11
+ vc: SkillViewController<any>;
12
+ didAddOrgRedirectDestination: string;
13
+ }): Promise<void>;
14
+ /**
15
+ *
16
+ * @deprecated do not even do this anymore
17
+ */
18
+ assertDoesNotRedirectToAddAOrgIfOrgExists(options: {
19
+ vc: SkillViewController<any>;
20
+ views: ViewFixture;
21
+ organizations: OrganizationFixture;
22
+ }): Promise<void>;
23
+ };
24
+ export default organizationAssert;
@@ -0,0 +1,70 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { vcAssertUtil, } from '@sprucelabs/heartwood-view-controllers';
11
+ import { assertOptions } from '@sprucelabs/schema';
12
+ import { TestRouter, } from '@sprucelabs/spruce-test-fixtures';
13
+ import { assert } from '@sprucelabs/test';
14
+ const organizationAssert = {
15
+ /**
16
+ *
17
+ * @deprecated use vcAssert.assertSkillViewIsScopedBy(this.vc, 'organization')
18
+ */
19
+ assertRedirectsToAddOrgIfNoOrgExists(options) {
20
+ return __awaiter(this, void 0, void 0, function* () {
21
+ assertOptions(options, [
22
+ 'views',
23
+ 'vc',
24
+ 'organizations',
25
+ 'didAddOrgRedirectDestination',
26
+ ]);
27
+ const { views, vc, organizations, didAddOrgRedirectDestination: redirectDestination, } = options;
28
+ yield organizations.deleteAllOrganizations();
29
+ TestRouter.setShouldThrowWhenRedirectingToBadSvc(false);
30
+ const router = views.getRouter();
31
+ yield vcAssertUtil.assertActionRedirects({
32
+ router,
33
+ action: () => views.load(vc),
34
+ destination: {
35
+ id: 'organization.add',
36
+ args: {
37
+ redirect: {
38
+ id: redirectDestination,
39
+ },
40
+ },
41
+ },
42
+ });
43
+ TestRouter.setShouldThrowWhenRedirectingToBadSvc(true);
44
+ });
45
+ },
46
+ /**
47
+ *
48
+ * @deprecated do not even do this anymore
49
+ */
50
+ assertDoesNotRedirectToAddAOrgIfOrgExists(options) {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ assertOptions(options, ['views', 'vc', 'organizations']);
53
+ const { vc, views, organizations } = options;
54
+ yield views.loginAsDemoPerson();
55
+ const latest = yield organizations.getNewestOrganization();
56
+ if (!latest) {
57
+ yield organizations.seedDemoOrganization();
58
+ }
59
+ let wasHit = false;
60
+ yield views.getRouter().on('did-redirect', () => {
61
+ wasHit = true;
62
+ });
63
+ TestRouter.setShouldThrowWhenRedirectingToBadSvc(false);
64
+ yield views.load(vc);
65
+ TestRouter.setShouldThrowWhenRedirectingToBadSvc(true);
66
+ assert.isFalse(wasHit, `I was redirected and didn't expect to be.`);
67
+ });
68
+ },
69
+ };
70
+ export default organizationAssert;
@@ -0,0 +1,24 @@
1
+ import { SkillViewController } from '@sprucelabs/heartwood-view-controllers';
2
+ import { OrganizationFixture, ViewFixture } from '@sprucelabs/spruce-test-fixtures';
3
+ declare const organizationAssert: {
4
+ /**
5
+ *
6
+ * @deprecated use vcAssert.assertSkillViewIsScopedBy(this.vc, 'organization')
7
+ */
8
+ assertRedirectsToAddOrgIfNoOrgExists(options: {
9
+ views: ViewFixture;
10
+ organizations: OrganizationFixture;
11
+ vc: SkillViewController<any>;
12
+ didAddOrgRedirectDestination: string;
13
+ }): Promise<void>;
14
+ /**
15
+ *
16
+ * @deprecated do not even do this anymore
17
+ */
18
+ assertDoesNotRedirectToAddAOrgIfOrgExists(options: {
19
+ vc: SkillViewController<any>;
20
+ views: ViewFixture;
21
+ organizations: OrganizationFixture;
22
+ }): Promise<void>;
23
+ };
24
+ export default organizationAssert;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const heartwood_view_controllers_1 = require("@sprucelabs/heartwood-view-controllers");
4
+ const schema_1 = require("@sprucelabs/schema");
5
+ const spruce_test_fixtures_1 = require("@sprucelabs/spruce-test-fixtures");
6
+ const test_1 = require("@sprucelabs/test");
7
+ const organizationAssert = {
8
+ /**
9
+ *
10
+ * @deprecated use vcAssert.assertSkillViewIsScopedBy(this.vc, 'organization')
11
+ */
12
+ async assertRedirectsToAddOrgIfNoOrgExists(options) {
13
+ (0, schema_1.assertOptions)(options, [
14
+ 'views',
15
+ 'vc',
16
+ 'organizations',
17
+ 'didAddOrgRedirectDestination',
18
+ ]);
19
+ const { views, vc, organizations, didAddOrgRedirectDestination: redirectDestination, } = options;
20
+ await organizations.deleteAllOrganizations();
21
+ spruce_test_fixtures_1.TestRouter.setShouldThrowWhenRedirectingToBadSvc(false);
22
+ const router = views.getRouter();
23
+ await heartwood_view_controllers_1.vcAssertUtil.assertActionRedirects({
24
+ router,
25
+ action: () => views.load(vc),
26
+ destination: {
27
+ id: 'organization.add',
28
+ args: {
29
+ redirect: {
30
+ id: redirectDestination,
31
+ },
32
+ },
33
+ },
34
+ });
35
+ spruce_test_fixtures_1.TestRouter.setShouldThrowWhenRedirectingToBadSvc(true);
36
+ },
37
+ /**
38
+ *
39
+ * @deprecated do not even do this anymore
40
+ */
41
+ async assertDoesNotRedirectToAddAOrgIfOrgExists(options) {
42
+ (0, schema_1.assertOptions)(options, ['views', 'vc', 'organizations']);
43
+ const { vc, views, organizations } = options;
44
+ await views.loginAsDemoPerson();
45
+ const latest = await organizations.getNewestOrganization();
46
+ if (!latest) {
47
+ await organizations.seedDemoOrganization();
48
+ }
49
+ let wasHit = false;
50
+ await views.getRouter().on('did-redirect', () => {
51
+ wasHit = true;
52
+ });
53
+ spruce_test_fixtures_1.TestRouter.setShouldThrowWhenRedirectingToBadSvc(false);
54
+ await views.load(vc);
55
+ spruce_test_fixtures_1.TestRouter.setShouldThrowWhenRedirectingToBadSvc(true);
56
+ test_1.assert.isFalse(wasHit, `I was redirected and didn't expect to be.`);
57
+ },
58
+ };
59
+ exports.default = organizationAssert;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sprucelabs/spruce-location-utils",
3
3
  "description": "Location Utilities",
4
- "version": "3.1.21",
4
+ "version": "3.2.2",
5
5
  "skill": {
6
6
  "namespace": "locations"
7
7
  },
@@ -18,16 +18,16 @@
18
18
  "build/index-module.d.ts",
19
19
  "build/renderers/locationRenderer.js",
20
20
  "build/renderers/locationRenderer.d.ts",
21
- "build/tests/utilities/organizationAssert.js",
22
- "build/tests/utilities/organizationAssert.d.ts",
21
+ "build/tests/organizationAssert.js",
22
+ "build/tests/organizationAssert.d.ts",
23
23
  "build/viewControllers/LocationListCard.vc.js",
24
24
  "build/viewControllers/LocationListCard.vc.d.ts",
25
25
  "build/esm/index-module.js",
26
26
  "build/esm/index-module.d.ts",
27
27
  "build/esm/renderers/locationRenderer.js",
28
28
  "build/esm/renderers/locationRenderer.d.ts",
29
- "build/esm/tests/utilities/organizationAssert.js",
30
- "build/esm/tests/utilities/organizationAssert.d.ts",
29
+ "build/esm/tests/organizationAssert.js",
30
+ "build/esm/tests/organizationAssert.d.ts",
31
31
  "build/esm/viewControllers/LocationListCard.vc.js",
32
32
  "build/esm/viewControllers/LocationListCard.vc.d.ts",
33
33
  "build/types-module.js",