@sprucelabs/spruce-cli 14.30.11 → 14.30.15

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 (43) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/build/__tests__/behavioral/AddingADependency.test.js +2 -2
  3. package/build/__tests__/behavioral/AddingADependency.test.js.map +1 -1
  4. package/build/__tests__/behavioral/DeployingToSandbox.test.js +1 -1
  5. package/build/__tests__/behavioral/DeployingToSandbox.test.js.map +1 -1
  6. package/build/__tests__/behavioral/InstallingASkillAtAnOrg.test.js +2 -2
  7. package/build/__tests__/behavioral/InstallingASkillAtAnOrg.test.js.map +1 -1
  8. package/build/__tests__/behavioral/LoggingInAsASkill.test.js +3 -3
  9. package/build/__tests__/behavioral/LoggingInAsASkill.test.js.map +1 -1
  10. package/build/__tests__/behavioral/RegisteringEventsOnBoot.test.js +1 -1
  11. package/build/__tests__/behavioral/RegisteringEventsOnBoot.test.js.map +1 -1
  12. package/build/__tests__/behavioral/RegisteringGlobalEvents.test.js +1 -1
  13. package/build/__tests__/behavioral/RegisteringGlobalEvents.test.js.map +1 -1
  14. package/build/__tests__/behavioral/RegisteringSkillViewOnBoot.test.js +1 -1
  15. package/build/__tests__/behavioral/RegisteringSkillViewOnBoot.test.js.map +1 -1
  16. package/build/__tests__/behavioral/organization/CreatingAnOrg.test.js +1 -1
  17. package/build/__tests__/behavioral/organization/CreatingAnOrg.test.js.map +1 -1
  18. package/build/__tests__/behavioral/person/SeeWhoIsLoggedIn.test.js +1 -1
  19. package/build/__tests__/behavioral/person/SeeWhoIsLoggedIn.test.js.map +1 -1
  20. package/build/__tests__/behavioral/skill/RegisteringASkill.test.d.ts +1 -0
  21. package/build/__tests__/behavioral/skill/RegisteringASkill.test.js +77 -17
  22. package/build/__tests__/behavioral/skill/RegisteringASkill.test.js.map +1 -1
  23. package/build/__tests__/behavioral/views/SettingUpViews.test.js +1 -1
  24. package/build/__tests__/behavioral/views/SettingUpViews.test.js.map +1 -1
  25. package/build/__tests__/implementation/SkillStore.test.js +1 -1
  26. package/build/__tests__/implementation/SkillStore.test.js.map +1 -1
  27. package/build/tests/AbstractCliTest.d.ts +1 -1
  28. package/build/tests/AbstractCliTest.js +9 -5
  29. package/build/tests/AbstractCliTest.js.map +1 -1
  30. package/package.json +31 -31
  31. package/src/__tests__/behavioral/AddingADependency.test.ts +2 -4
  32. package/src/__tests__/behavioral/DeployingToSandbox.test.ts +1 -1
  33. package/src/__tests__/behavioral/InstallingASkillAtAnOrg.test.ts +2 -4
  34. package/src/__tests__/behavioral/LoggingInAsASkill.test.ts +3 -5
  35. package/src/__tests__/behavioral/RegisteringEventsOnBoot.test.ts +1 -3
  36. package/src/__tests__/behavioral/RegisteringGlobalEvents.test.ts +1 -3
  37. package/src/__tests__/behavioral/RegisteringSkillViewOnBoot.test.ts +1 -3
  38. package/src/__tests__/behavioral/organization/CreatingAnOrg.test.ts +1 -1
  39. package/src/__tests__/behavioral/person/SeeWhoIsLoggedIn.test.ts +1 -1
  40. package/src/__tests__/behavioral/skill/RegisteringASkill.test.ts +24 -1
  41. package/src/__tests__/behavioral/views/SettingUpViews.test.ts +1 -1
  42. package/src/__tests__/implementation/SkillStore.test.ts +1 -1
  43. package/src/tests/AbstractCliTest.ts +5 -3
@@ -21,7 +21,7 @@ export default class DeployingToSandboxTest extends AbstractCliTest {
21
21
  protected static async beforeEach() {
22
22
  await super.beforeEach()
23
23
 
24
- const personFixture = this.getPersonFixture()
24
+ const personFixture = this.people
25
25
  await personFixture.loginAsDemoPerson(this.sandboxDemoNumber)
26
26
  }
27
27
 
@@ -28,7 +28,7 @@ export default class InstallingASkillAtAnOrgTest extends AbstractCliTest {
28
28
  name: 'my amazing skill',
29
29
  })
30
30
 
31
- await this.getPersonFixture().logout()
31
+ await this.people.logout()
32
32
 
33
33
  await this.Cli()
34
34
 
@@ -145,8 +145,6 @@ export default class InstallingASkillAtAnOrgTest extends AbstractCliTest {
145
145
  }
146
146
 
147
147
  private static async login() {
148
- await this.getPersonFixture().loginAsDemoPerson(
149
- process.env.DEMO_NUMBER_INSTALL_SKILL
150
- )
148
+ await this.people.loginAsDemoPerson(process.env.DEMO_NUMBER_INSTALL_SKILL)
151
149
  }
152
150
  }
@@ -12,14 +12,12 @@ export default class LoggingInAsASkillTest extends AbstractSkillTest {
12
12
  protected static async beforeAll() {
13
13
  await super.beforeAll()
14
14
 
15
- await this.getPersonFixture().loginAsDemoPerson(
16
- process.env.DEMO_NUMBER_LOGIN_AS_SKILL
17
- )
15
+ await this.people.loginAsDemoPerson(process.env.DEMO_NUMBER_LOGIN_AS_SKILL)
18
16
 
19
17
  const skillFixture = this.getSkillFixture()
20
18
  await skillFixture.clearAllSkills()
21
19
 
22
- await this.getPersonFixture().logout()
20
+ await this.people.logout()
23
21
  }
24
22
 
25
23
  @test()
@@ -50,7 +48,7 @@ export default class LoggingInAsASkillTest extends AbstractSkillTest {
50
48
  }
51
49
 
52
50
  private static async login() {
53
- const person = await this.getPersonFixture().loginAsDemoPerson(
51
+ const person = await this.people.loginAsDemoPerson(
54
52
  process.env.DEMO_NUMBER_LOGIN_AS_SKILL
55
53
  )
56
54
 
@@ -14,9 +14,7 @@ export default class RegisteringEventsOnBootTest extends AbstractEventTest {
14
14
  protected static async beforeEach() {
15
15
  await super.beforeEach()
16
16
 
17
- await this.getPersonFixture().loginAsDemoPerson(
18
- process.env.DEMO_NUMBER_EVENTS_ON_BOOT
19
- )
17
+ await this.people.loginAsDemoPerson(process.env.DEMO_NUMBER_EVENTS_ON_BOOT)
20
18
  }
21
19
 
22
20
  @test()
@@ -18,9 +18,7 @@ export default class RegisteringGlobalEventsTest extends AbstractSkillTest {
18
18
  protected static async beforeAll() {
19
19
  await super.beforeAll()
20
20
 
21
- await this.getPersonFixture().loginAsDemoPerson(
22
- process.env.DEMO_NUMBER_GLOBAL_EVENTS
23
- )
21
+ await this.people.loginAsDemoPerson(process.env.DEMO_NUMBER_GLOBAL_EVENTS)
24
22
 
25
23
  await this.resetAccount()
26
24
 
@@ -50,9 +50,7 @@ export default class RegisteringSkillViewOnBootTest extends AbstractSkillTest {
50
50
  }
51
51
 
52
52
  protected static async registerCurrentSkillAndInstallToOrg() {
53
- await this.getPersonFixture().loginAsDemoPerson(
54
- process.env.DEMO_NUMBER_VIEWS_ON_BOOT
55
- )
53
+ await this.people.loginAsDemoPerson(process.env.DEMO_NUMBER_VIEWS_ON_BOOT)
56
54
  const skillFixture = this.getSkillFixture()
57
55
  const orgFixture = this.getOrganizationFixture()
58
56
 
@@ -15,7 +15,7 @@ export default class CreatingAnOrgTest extends AbstractCliTest {
15
15
 
16
16
  await this.FeatureFixture().installCachedFeatures('organizations')
17
17
 
18
- await this.getPersonFixture().loginAsDemoPerson()
18
+ await this.people.loginAsDemoPerson()
19
19
 
20
20
  const results = await this.Action('organization', 'create').execute({
21
21
  nameReadable: 'My new org',
@@ -21,7 +21,7 @@ export default class SeeWhoIsLoggedInTest extends AbstractCliTest {
21
21
  @test()
22
22
  protected static async canSeeWhoIsLoggedIn() {
23
23
  await this.FeatureFixture().installCachedFeatures('skills')
24
- await this.getPersonFixture().loginAsDemoPerson()
24
+ await this.people.loginAsDemoPerson()
25
25
 
26
26
  const results = await this.Action('person', 'whoami').execute({})
27
27
 
@@ -1,3 +1,4 @@
1
+ import { MercuryClientFactory } from '@sprucelabs/mercury-client'
1
2
  import { eventResponseUtil } from '@sprucelabs/spruce-event-utils'
2
3
  import { test, assert } from '@sprucelabs/test'
3
4
  import { errorAssertUtil } from '@sprucelabs/test-utils'
@@ -26,10 +27,32 @@ export default class RegisteringASkillTest extends AbstractCliTest {
26
27
  )
27
28
  }
28
29
 
30
+ @test()
31
+ protected static async returnsErrorWhenRegistrationFails() {
32
+ MercuryClientFactory.setIsTestMode(true)
33
+
34
+ await this.people.loginAsDemoPerson()
35
+ await this.FeatureFixture().installCachedFeatures('skills')
36
+ const slug = `my-new-skill-${new Date().getTime()}`
37
+
38
+ const client = await this.connectToApi()
39
+ await client.on('register-skill::v2020_12_25', (() => {
40
+ assert.fail('what the!!??')
41
+ }) as any)
42
+
43
+ const results = await this.Action('skill', 'register').execute({
44
+ nameReadable: 'My great skill',
45
+ nameKebab: slug,
46
+ })
47
+
48
+ assert.isTruthy(results.errors)
49
+ assert.doesInclude(results.errors[0].message, 'what the!!??')
50
+ }
51
+
29
52
  @test()
30
53
  protected static async canRegisterSkill() {
31
54
  await this.FeatureFixture().installCachedFeatures('skills')
32
- await this.getPersonFixture().loginAsDemoPerson()
55
+ await this.people.loginAsDemoPerson()
33
56
 
34
57
  const slug = `my-new-skill-${new Date().getTime()}`
35
58
  const results = await this.Action('skill', 'register').execute({
@@ -24,7 +24,7 @@ export default class SettingUpViewsTest extends AbstractCliTest {
24
24
  },
25
25
  ])
26
26
 
27
- await this.getPersonFixture().loginAsDemoPerson()
27
+ await this.people.loginAsDemoPerson()
28
28
 
29
29
  const dependencies = this.Service('dependency').get()
30
30
  assert.isLength(dependencies, 1)
@@ -66,7 +66,7 @@ export default class SkillStoreTest extends AbstractCliTest {
66
66
  await this.FeatureFixture().installCachedFeatures('skills')
67
67
 
68
68
  const slug = `awesome-skill-${new Date().getTime()}`
69
- await this.getPersonFixture().loginAsDemoPerson()
69
+ await this.people.loginAsDemoPerson()
70
70
 
71
71
  const skillStore = this.Store('skill')
72
72
 
@@ -1,4 +1,5 @@
1
1
  import pathUtil from 'path'
2
+ import { MercuryClientFactory } from '@sprucelabs/mercury-client'
2
3
  import { SchemaRegistry } from '@sprucelabs/schema'
3
4
  import { diskUtil } from '@sprucelabs/spruce-skill-utils'
4
5
  import { templates } from '@sprucelabs/spruce-templates'
@@ -104,6 +105,7 @@ export default abstract class AbstractCliTest extends AbstractSpruceTest {
104
105
  SkillStore.clearCurrentSkill()
105
106
  EventStore.clearCache()
106
107
  CommandService.clearMockResponses()
108
+ MercuryClientFactory.reset()
107
109
  }
108
110
 
109
111
  protected static async afterEach() {
@@ -231,7 +233,7 @@ export default abstract class AbstractCliTest extends AbstractSpruceTest {
231
233
  return this.mercuryFixture
232
234
  }
233
235
 
234
- protected static getPersonFixture() {
236
+ protected static get people() {
235
237
  if (!this.personFixture) {
236
238
  this.personFixture = new PersonFixture(
237
239
  this.getMercuryFixture().getApiClientFactory()
@@ -285,7 +287,7 @@ export default abstract class AbstractCliTest extends AbstractSpruceTest {
285
287
  protected static getOrganizationFixture() {
286
288
  if (!this.organizationFixture) {
287
289
  this.organizationFixture = new OrganizationFixture(
288
- this.getPersonFixture(),
290
+ this.people,
289
291
  this.StoreFactory()
290
292
  )
291
293
  }
@@ -296,7 +298,7 @@ export default abstract class AbstractCliTest extends AbstractSpruceTest {
296
298
  protected static getSkillFixture() {
297
299
  if (!this.skillFixture) {
298
300
  this.skillFixture = new SkillFixture(
299
- this.getPersonFixture(),
301
+ this.people,
300
302
  this.StoreFactory(),
301
303
  this.getMercuryFixture().getApiClientFactory()
302
304
  )