@sprucelabs/spruce-cli 23.1.0 → 24.1.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 (135) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/LICENSE +21 -0
  3. package/build/__tests__/behavioral/DeployingToSandbox.test.d.ts +6 -1
  4. package/build/__tests__/behavioral/DeployingToSandbox.test.js +54 -35
  5. package/build/__tests__/behavioral/DeployingToSandbox.test.js.map +1 -1
  6. package/build/__tests__/behavioral/conversations/CreatingAConversationTopic.test.js +2 -2
  7. package/build/__tests__/behavioral/conversations/CreatingAConversationTopic.test.js.map +1 -1
  8. package/build/__tests__/behavioral/conversations/RegisteringConversationsOnBoot.test.js +1 -1
  9. package/build/__tests__/behavioral/conversations/RegisteringConversationsOnBoot.test.js.map +1 -1
  10. package/build/__tests__/behavioral/conversations/TestingAConversation.test.js +5 -5
  11. package/build/__tests__/behavioral/conversations/TestingAConversation.test.js.map +1 -1
  12. package/build/__tests__/behavioral/organization/CreatingAnOrg.test.js.map +1 -1
  13. package/build/__tests__/behavioral/schemas/CreatingSchemasWithGenerics.test.js +1 -1
  14. package/build/__tests__/behavioral/schemas/CreatingSchemasWithGenerics.test.js.map +1 -1
  15. package/build/__tests__/behavioral/tests/migrationToInstance/AbstractInstanceTest.d.ts +11 -0
  16. package/build/__tests__/behavioral/tests/migrationToInstance/AbstractInstanceTest.js +49 -0
  17. package/build/__tests__/behavioral/tests/migrationToInstance/AbstractInstanceTest.js.map +1 -0
  18. package/build/__tests__/behavioral/tests/migrationToInstance/InstanceBasedTesting.test.d.ts +5 -0
  19. package/build/__tests__/behavioral/tests/migrationToInstance/InstanceBasedTesting.test.js +34 -0
  20. package/build/__tests__/behavioral/tests/migrationToInstance/InstanceBasedTesting.test.js.map +1 -0
  21. package/build/__tests__/behavioral/tests/migrationToInstance/MigratingTests.test.d.ts +12 -0
  22. package/build/__tests__/behavioral/tests/migrationToInstance/MigratingTests.test.js +88 -0
  23. package/build/__tests__/behavioral/tests/migrationToInstance/MigratingTests.test.js.map +1 -0
  24. package/build/__tests__/behavioral/tests/migrationToInstance/StaticTestFinder.test.d.ts +13 -0
  25. package/build/__tests__/behavioral/tests/migrationToInstance/StaticTestFinder.test.js +109 -0
  26. package/build/__tests__/behavioral/tests/migrationToInstance/StaticTestFinder.test.js.map +1 -0
  27. package/build/__tests__/behavioral/tests/migrationToInstance/StaticTestsWhenAlreadyExists.test.d.ts +4 -0
  28. package/build/__tests__/behavioral/tests/migrationToInstance/StaticTestsWhenAlreadyExists.test.js +29 -0
  29. package/build/__tests__/behavioral/tests/migrationToInstance/StaticTestsWhenAlreadyExists.test.js.map +1 -0
  30. package/build/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceMigrator.test.d.ts +26 -0
  31. package/build/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceMigrator.test.js +259 -0
  32. package/build/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceMigrator.test.js.map +1 -0
  33. package/build/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceTestFileMigrator.test.d.ts +26 -0
  34. package/build/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceTestFileMigrator.test.js +202 -0
  35. package/build/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceTestFileMigrator.test.js.map +1 -0
  36. package/build/__tests__/behavioral/tests/migrationToInstance/support/AbstractInstanceTest.txt +24 -0
  37. package/build/__tests__/behavioral/tests/migrationToInstance/support/AbstractStaticTest.txt +24 -0
  38. package/build/__tests__/behavioral/tests/migrationToInstance/support/InstanceTest.txt +36 -0
  39. package/build/__tests__/behavioral/tests/migrationToInstance/support/InstanceTest2.txt +63 -0
  40. package/build/__tests__/behavioral/tests/migrationToInstance/support/InstanceTest3.txt +222 -0
  41. package/build/__tests__/behavioral/tests/migrationToInstance/support/StaticTest.txt +34 -0
  42. package/build/__tests__/behavioral/tests/migrationToInstance/support/StaticTest2.txt +62 -0
  43. package/build/__tests__/behavioral/tests/migrationToInstance/support/StaticTest3.txt +221 -0
  44. package/build/__tests__/behavioral/tests/migrationToInstance/testFileContentsGenerators.d.ts +2 -0
  45. package/build/__tests__/behavioral/tests/migrationToInstance/testFileContentsGenerators.js +51 -0
  46. package/build/__tests__/behavioral/tests/migrationToInstance/testFileContentsGenerators.js.map +1 -0
  47. package/build/__tests__/behavioral/versions/ResolvingVersions.test.js +0 -3
  48. package/build/__tests__/behavioral/versions/ResolvingVersions.test.js.map +1 -1
  49. package/build/__tests__/implementation/OrganizationStore.test.js +2 -2
  50. package/build/__tests__/implementation/OrganizationStore.test.js.map +1 -1
  51. package/build/__tests__/implementation/TerminalInterface.test.d.ts +1 -0
  52. package/build/__tests__/implementation/TerminalInterface.test.js +6 -0
  53. package/build/__tests__/implementation/TerminalInterface.test.js.map +1 -1
  54. package/build/__tests__/testDirsAndFiles/static_test_migration_1/src/__tests__/AnotherStaticTest.test.ts +33 -0
  55. package/build/__tests__/testDirsAndFiles/static_test_migration_1/src/__tests__/ShouldBeIgnored.ts +0 -0
  56. package/build/__tests__/testDirsAndFiles/static_test_migration_1/src/__tests__/StaticTest1.test.ts +33 -0
  57. package/build/__tests__/testDirsAndFiles/static_test_migration_2/src/DoNotInclude.ts +0 -0
  58. package/build/__tests__/testDirsAndFiles/static_test_migration_2/src/__tests__/AStaticTest.test.ts +33 -0
  59. package/build/__tests__/testDirsAndFiles/static_test_migration_2/src/__tests__/AnotherStaticTest1.test.ts +33 -0
  60. package/build/__tests__/testDirsAndFiles/static_test_migration_3/NotAFileThatShouldBeMigrated.ts +0 -0
  61. package/build/__tests__/testDirsAndFiles/static_test_migration_3/src/__tests__/AStaticTest2.test.ts +17 -0
  62. package/build/__tests__/testDirsAndFiles/static_test_migration_3/src/__tests__/AbstractWhateverTest.ts +3 -0
  63. package/build/errors/SpruceError.js +1 -1
  64. package/build/errors/SpruceError.js.map +1 -1
  65. package/build/features/skill/actions/LoginAction.js +1 -2
  66. package/build/features/skill/actions/LoginAction.js.map +1 -1
  67. package/build/features/test/actions/CreateAction.d.ts +1 -0
  68. package/build/features/test/actions/CreateAction.js +13 -0
  69. package/build/features/test/actions/CreateAction.js.map +1 -1
  70. package/build/features/test/actions/MigrateAction.d.ts +17 -0
  71. package/build/features/test/actions/MigrateAction.js +39 -0
  72. package/build/features/test/actions/MigrateAction.js.map +1 -0
  73. package/build/index.js +0 -0
  74. package/build/tests/staticToInstanceMigration/StaticTestFinder.d.ts +8 -0
  75. package/build/tests/staticToInstanceMigration/StaticTestFinder.js +23 -0
  76. package/build/tests/staticToInstanceMigration/StaticTestFinder.js.map +1 -0
  77. package/build/tests/staticToInstanceMigration/StaticToInstanceMigrator.d.ts +58 -0
  78. package/build/tests/staticToInstanceMigration/StaticToInstanceMigrator.js +48 -0
  79. package/build/tests/staticToInstanceMigration/StaticToInstanceMigrator.js.map +1 -0
  80. package/build/tests/staticToInstanceMigration/StaticToInstanceTestFileMigrator.d.ts +12 -0
  81. package/build/tests/staticToInstanceMigration/StaticToInstanceTestFileMigrator.js +138 -0
  82. package/build/tests/staticToInstanceMigration/StaticToInstanceTestFileMigrator.js.map +1 -0
  83. package/build/utilities/isCi.js +1 -1
  84. package/build/utilities/isCi.js.map +1 -1
  85. package/package.json +28 -45
  86. package/src/__tests__/behavioral/DeployingToSandbox.test.ts +77 -44
  87. package/src/__tests__/behavioral/conversations/CreatingAConversationTopic.test.ts +2 -2
  88. package/src/__tests__/behavioral/conversations/RegisteringConversationsOnBoot.test.ts +1 -1
  89. package/src/__tests__/behavioral/conversations/TestingAConversation.test.ts +5 -5
  90. package/src/__tests__/behavioral/organization/CreatingAnOrg.test.ts +0 -1
  91. package/src/__tests__/behavioral/schemas/CreatingSchemasWithGenerics.test.ts +2 -1
  92. package/src/__tests__/behavioral/tests/migrationToInstance/AbstractInstanceTest.ts +77 -0
  93. package/src/__tests__/behavioral/tests/migrationToInstance/InstanceBasedTesting.test.ts +19 -0
  94. package/src/__tests__/behavioral/tests/migrationToInstance/MigratingTests.test.ts +99 -0
  95. package/src/__tests__/behavioral/tests/migrationToInstance/StaticTestFinder.test.ts +72 -0
  96. package/src/__tests__/behavioral/tests/migrationToInstance/StaticTestsWhenAlreadyExists.test.ts +31 -0
  97. package/src/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceMigrator.test.ts +252 -0
  98. package/src/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceTestFileMigrator.test.ts +193 -0
  99. package/src/__tests__/behavioral/tests/migrationToInstance/support/AbstractInstanceTest.txt +24 -0
  100. package/src/__tests__/behavioral/tests/migrationToInstance/support/AbstractStaticTest.txt +24 -0
  101. package/src/__tests__/behavioral/tests/migrationToInstance/support/InstanceTest.txt +36 -0
  102. package/src/__tests__/behavioral/tests/migrationToInstance/support/InstanceTest2.txt +63 -0
  103. package/src/__tests__/behavioral/tests/migrationToInstance/support/InstanceTest3.txt +222 -0
  104. package/src/__tests__/behavioral/tests/migrationToInstance/support/StaticTest.txt +34 -0
  105. package/src/__tests__/behavioral/tests/migrationToInstance/support/StaticTest2.txt +62 -0
  106. package/src/__tests__/behavioral/tests/migrationToInstance/support/StaticTest3.txt +221 -0
  107. package/src/__tests__/behavioral/tests/migrationToInstance/testFileContentsGenerators.ts +50 -0
  108. package/src/__tests__/behavioral/versions/ResolvingVersions.test.ts +1 -3
  109. package/src/__tests__/implementation/OrganizationStore.test.ts +6 -2
  110. package/src/__tests__/implementation/TerminalInterface.test.ts +9 -0
  111. package/src/__tests__/testDirsAndFiles/static_test_migration_1/src/__tests__/AnotherStaticTest.test.ts +33 -0
  112. package/src/__tests__/testDirsAndFiles/static_test_migration_1/src/__tests__/ShouldBeIgnored.ts +0 -0
  113. package/src/__tests__/testDirsAndFiles/static_test_migration_1/src/__tests__/StaticTest1.test.ts +33 -0
  114. package/src/__tests__/testDirsAndFiles/static_test_migration_2/src/DoNotInclude.ts +0 -0
  115. package/src/__tests__/testDirsAndFiles/static_test_migration_2/src/__tests__/AStaticTest.test.ts +33 -0
  116. package/src/__tests__/testDirsAndFiles/static_test_migration_2/src/__tests__/AnotherStaticTest1.test.ts +33 -0
  117. package/src/__tests__/testDirsAndFiles/static_test_migration_3/NotAFileThatShouldBeMigrated.ts +0 -0
  118. package/src/__tests__/testDirsAndFiles/static_test_migration_3/src/__tests__/AStaticTest2.test.ts +17 -0
  119. package/src/__tests__/testDirsAndFiles/static_test_migration_3/src/__tests__/AbstractWhateverTest.ts +3 -0
  120. package/src/errors/SpruceError.ts +1 -1
  121. package/src/features/skill/actions/LoginAction.ts +8 -7
  122. package/src/features/test/actions/CreateAction.ts +17 -0
  123. package/src/features/test/actions/MigrateAction.ts +41 -0
  124. package/src/tests/staticToInstanceMigration/StaticTestFinder.ts +25 -0
  125. package/src/tests/staticToInstanceMigration/StaticToInstanceMigrator.ts +73 -0
  126. package/src/tests/staticToInstanceMigration/StaticToInstanceTestFileMigrator.ts +197 -0
  127. package/src/utilities/isCi.ts +1 -1
  128. package/.DS_Store +0 -0
  129. package/.env +0 -25
  130. package/.env-dev +0 -24
  131. package/.eslintcache +0 -1
  132. package/dist/spruce-darwin-arm64 +0 -0
  133. package/dist/spruce-linux-arm64 +0 -0
  134. package/junit.xml +0 -42
  135. package/yarn-error.log +0 -597
@@ -0,0 +1,202 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ 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;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ var __importDefault = (this && this.__importDefault) || function (mod) {
42
+ return (mod && mod.__esModule) ? mod : { "default": mod };
43
+ };
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ const spruce_skill_utils_1 = require("@sprucelabs/spruce-skill-utils");
46
+ const test_utils_1 = __importStar(require("@sprucelabs/test-utils"));
47
+ const StaticToInstanceTestFileMigrator_1 = __importDefault(require("../../../../tests/staticToInstanceMigration/StaticToInstanceTestFileMigrator"));
48
+ let StaticToInstanceTestFileMigratorTest = class StaticToInstanceTestFileMigratorTest extends test_utils_1.default {
49
+ migrator = StaticToInstanceTestFileMigrator_1.default.Migrator();
50
+ throwsWithMissing() {
51
+ //@ts-ignore
52
+ const err = test_utils_1.assert.doesThrow(() => this.migrate());
53
+ test_utils_1.errorAssert.assertError(err, 'MISSING_PARAMETERS', {
54
+ parameters: ['contents'],
55
+ });
56
+ }
57
+ returnsEmptyString() {
58
+ this.assertMigratedEquals('', '');
59
+ }
60
+ fixesStaticFunction() {
61
+ this.assertMigratedEquals(`@test()
62
+ protected static myTest() {}`, `@test()
63
+ protected myTest() {}`);
64
+ }
65
+ fixesStaticAsyncFunctions() {
66
+ this.assertMigratedEquals(`@test()
67
+ protected static async myTest() {}`, `@test()
68
+ protected async myTest() {}`);
69
+ }
70
+ doesNotMessWithStaticInVariableName() {
71
+ this.assertMigratedEquals(`protected staticInName() {}`, `protected staticInName() {}`);
72
+ }
73
+ addsSuiteDecoratorToClassIfNotThere() {
74
+ this.assertMigratedEquals(`export default class Test {}`, `@suite()\nexport default class Test {}`);
75
+ }
76
+ doesNotAddSuitIfAnotherClassExported() {
77
+ this.assertMigratedEquals(`export class Test {}`, `export class Test {}`);
78
+ }
79
+ doesNotAddSuiteIfAlreadyThere() {
80
+ this.assertMigratedEquals(`@suite()\nexport default class Test {}`, `@suite()\nexport default class Test {}`);
81
+ }
82
+ addsImportIfNotThere() {
83
+ this.assertMigratedEquals(`import { test } from '@sprucelabs/test-utils'`, `import { test, suite } from '@sprucelabs/test-utils'`);
84
+ }
85
+ doesNotMessWithAnythingWithTestInName() {
86
+ this.assertMigratedEquals(`protected testing() {}`, `protected testing() {}`);
87
+ }
88
+ doesNoIncludeSuiteTwice() {
89
+ this.assertMigratedEquals(`import { test, suite } from '@sprucelabs/test-utils'`, `import { test, suite } from '@sprucelabs/test-utils'`);
90
+ }
91
+ includesSuiteEvenIfSuiteIsInAMethodName() {
92
+ this.assertMigratedEquals(`import { test } from '@sprucelabs/test-utils
93
+ protected suiteMethod() {}`, `import { test, suite } from '@sprucelabs/test-utils
94
+ protected suiteMethod() {}`);
95
+ }
96
+ includesSuiteWithMultipleImports() {
97
+ this.assertMigratedEquals(`import AbstractSpruceTest, {
98
+ test,
99
+ assert,
100
+ errorAssert,
101
+ } from '@sprucelabs/test-utils'`, `import AbstractSpruceTest, {
102
+ test,
103
+ suite,
104
+ assert,
105
+ errorAssert,
106
+ } from '@sprucelabs/test-utils'`);
107
+ }
108
+ canMigrateWholeTest() {
109
+ const before = this.readTestFile('StaticTest.txt');
110
+ const expected = this.readTestFile('InstanceTest.txt');
111
+ this.assertMigratedEquals(before, expected);
112
+ }
113
+ properlyMigrationsAbstractTests() {
114
+ const before = this.readTestFile('AbstractStaticTest.txt');
115
+ const expected = this.readTestFile('AbstractInstanceTest.txt');
116
+ this.assertMigratedEquals(before, expected);
117
+ }
118
+ canMigrateMoreComplexTest() {
119
+ const before = this.readTestFile('StaticTest2.txt');
120
+ const expected = this.readTestFile('InstanceTest2.txt');
121
+ this.assertMigratedEquals(before, expected);
122
+ }
123
+ canMigrateAnotherComplexTest() {
124
+ const before = this.readTestFile('StaticTest3.txt');
125
+ const expected = this.readTestFile('InstanceTest3.txt');
126
+ this.assertMigratedEquals(before, expected);
127
+ }
128
+ readTestFile(name) {
129
+ return spruce_skill_utils_1.diskUtil.readFile(this.resolveTestClassPath(name));
130
+ }
131
+ resolveTestClassPath(name) {
132
+ return this.resolvePath(__dirname, 'support', name);
133
+ }
134
+ assertMigratedEquals(contents, expected) {
135
+ const actual = this.migrate(contents);
136
+ const cleanedActual = this.cleanString(actual);
137
+ const cleanedExpected = this.cleanString(expected);
138
+ test_utils_1.assert.isTrue(cleanedActual == cleanedExpected, `${actual}\n\ndoes not equal\n\n${expected}`);
139
+ }
140
+ cleanString(contents) {
141
+ return contents.replace(/\s{2,}/g, ' ').trim();
142
+ }
143
+ migrate(contents) {
144
+ return this.migrator.migrate(contents);
145
+ }
146
+ };
147
+ __decorate([
148
+ (0, test_utils_1.test)()
149
+ ], StaticToInstanceTestFileMigratorTest.prototype, "throwsWithMissing", null);
150
+ __decorate([
151
+ (0, test_utils_1.test)()
152
+ ], StaticToInstanceTestFileMigratorTest.prototype, "returnsEmptyString", null);
153
+ __decorate([
154
+ (0, test_utils_1.test)()
155
+ ], StaticToInstanceTestFileMigratorTest.prototype, "fixesStaticFunction", null);
156
+ __decorate([
157
+ (0, test_utils_1.test)()
158
+ ], StaticToInstanceTestFileMigratorTest.prototype, "fixesStaticAsyncFunctions", null);
159
+ __decorate([
160
+ (0, test_utils_1.test)()
161
+ ], StaticToInstanceTestFileMigratorTest.prototype, "doesNotMessWithStaticInVariableName", null);
162
+ __decorate([
163
+ (0, test_utils_1.test)()
164
+ ], StaticToInstanceTestFileMigratorTest.prototype, "addsSuiteDecoratorToClassIfNotThere", null);
165
+ __decorate([
166
+ (0, test_utils_1.test)()
167
+ ], StaticToInstanceTestFileMigratorTest.prototype, "doesNotAddSuitIfAnotherClassExported", null);
168
+ __decorate([
169
+ (0, test_utils_1.test)()
170
+ ], StaticToInstanceTestFileMigratorTest.prototype, "doesNotAddSuiteIfAlreadyThere", null);
171
+ __decorate([
172
+ (0, test_utils_1.test)()
173
+ ], StaticToInstanceTestFileMigratorTest.prototype, "addsImportIfNotThere", null);
174
+ __decorate([
175
+ (0, test_utils_1.test)()
176
+ ], StaticToInstanceTestFileMigratorTest.prototype, "doesNotMessWithAnythingWithTestInName", null);
177
+ __decorate([
178
+ (0, test_utils_1.test)()
179
+ ], StaticToInstanceTestFileMigratorTest.prototype, "doesNoIncludeSuiteTwice", null);
180
+ __decorate([
181
+ (0, test_utils_1.test)()
182
+ ], StaticToInstanceTestFileMigratorTest.prototype, "includesSuiteEvenIfSuiteIsInAMethodName", null);
183
+ __decorate([
184
+ (0, test_utils_1.test)()
185
+ ], StaticToInstanceTestFileMigratorTest.prototype, "includesSuiteWithMultipleImports", null);
186
+ __decorate([
187
+ (0, test_utils_1.test)()
188
+ ], StaticToInstanceTestFileMigratorTest.prototype, "canMigrateWholeTest", null);
189
+ __decorate([
190
+ (0, test_utils_1.test)()
191
+ ], StaticToInstanceTestFileMigratorTest.prototype, "properlyMigrationsAbstractTests", null);
192
+ __decorate([
193
+ (0, test_utils_1.test)()
194
+ ], StaticToInstanceTestFileMigratorTest.prototype, "canMigrateMoreComplexTest", null);
195
+ __decorate([
196
+ (0, test_utils_1.test)()
197
+ ], StaticToInstanceTestFileMigratorTest.prototype, "canMigrateAnotherComplexTest", null);
198
+ StaticToInstanceTestFileMigratorTest = __decorate([
199
+ (0, test_utils_1.suite)()
200
+ ], StaticToInstanceTestFileMigratorTest);
201
+ exports.default = StaticToInstanceTestFileMigratorTest;
202
+ //# sourceMappingURL=StaticToInstanceTestFileMigrator.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StaticToInstanceTestFileMigrator.test.js","sourceRoot":"","sources":["../../../../../src/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceTestFileMigrator.test.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,24 @@
1
+ import { AbstractSpruceFixtureTest } from '@sprucelabs/spruce-test-fixtures'
2
+ import { assert } from '@sprucelabs/test-utils'
3
+ import HomeIntegrationsStore from '../../stores/HomeIntegrations.store'
4
+ import EventFaker from './EventFaker'
5
+
6
+ export default abstract class AbstractGoogleTest extends AbstractSpruceFixtureTest {
7
+ protected eventFaker!: EventFaker
8
+ private homeIntegrations!: HomeIntegrationsStore
9
+
10
+ protected async beforeEach(): Promise<void> {
11
+ await super.beforeEach()
12
+ this.eventFaker = new EventFaker()
13
+ this.homeIntegrations = await this.stores.getStore('homeIntegrations')
14
+ }
15
+
16
+ protected async getFirstHomeIntegration() {
17
+ const match = await this.homeIntegrations.findOne(
18
+ {},
19
+ { shouldIncludePrivateFields: true }
20
+ )
21
+ assert.isTruthy(match, 'No home integration found')
22
+ return match
23
+ }
24
+ }
@@ -0,0 +1,24 @@
1
+ import { AbstractSpruceFixtureTest } from '@sprucelabs/spruce-test-fixtures'
2
+ import { assert } from '@sprucelabs/test-utils'
3
+ import HomeIntegrationsStore from '../../stores/HomeIntegrations.store'
4
+ import EventFaker from './EventFaker'
5
+
6
+ export default abstract class AbstractGoogleTest extends AbstractSpruceFixtureTest {
7
+ protected static eventFaker: EventFaker
8
+ private static homeIntegrations: HomeIntegrationsStore
9
+
10
+ protected static async beforeEach(): Promise<void> {
11
+ await super.beforeEach()
12
+ this.eventFaker = new EventFaker()
13
+ this.homeIntegrations = await this.stores.getStore('homeIntegrations')
14
+ }
15
+
16
+ protected static async getFirstHomeIntegration() {
17
+ const match = await this.homeIntegrations.findOne(
18
+ {},
19
+ { shouldIncludePrivateFields: true }
20
+ )
21
+ assert.isTruthy(match, 'No home integration found')
22
+ return match
23
+ }
24
+ }
@@ -0,0 +1,36 @@
1
+ import { assertOptions } from '@sprucelabs/schema'
2
+ import { fake } from '@sprucelabs/spruce-test-fixtures'
3
+ import AbstractSpruceTest, {
4
+ test,
5
+ suite,
6
+ assert,
7
+ errorAssert,
8
+ } from '@sprucelabs/test-utils'
9
+
10
+ @fake.login()
11
+ @suite()
12
+ export default class StaticTestFinderTest extends AbstractSpruceTest {
13
+ @test()
14
+ protected async throwsWithMissing() {
15
+ const finder = StaticTestFinder.Finder()
16
+ const err = await assert.doesThrowAsync(() => finder.find())
17
+ errorAssert.assertError(err, 'MISSING_PARAMETERS', {
18
+ parameters: ['lookupDir'],
19
+ })
20
+ }
21
+
22
+ @test()
23
+ protected async yourNextTest() {
24
+ assert.isTrue(false)
25
+ }
26
+ }
27
+
28
+ class StaticTestFinder {
29
+ public static Finder() {
30
+ return new this()
31
+ }
32
+
33
+ public async find() {
34
+ assertOptions({}, ['lookupDir'])
35
+ }
36
+ }
@@ -0,0 +1,63 @@
1
+ import { fake, seed } from '@sprucelabs/spruce-test-fixtures'
2
+ import { assert, test, suite } from '@sprucelabs/test-utils'
3
+ import { HomeIntegration, PublicHomeIntegration } from '../../../google.types'
4
+ import AbstractGoogleTest from '../../support/AbstractGoogleTest'
5
+
6
+ @fake.login()
7
+ @suite()
8
+ export default class ListHomeIntegrationsLIstenerTest extends AbstractGoogleTest {
9
+ protected async beforeEach(): Promise<void> {
10
+ await super.beforeEach()
11
+ await this.bootSkill()
12
+ }
13
+
14
+ protected async afterEach(): Promise<void> {
15
+ }
16
+
17
+ @test()
18
+ protected async skillIsListening() {
19
+ await this.emit()
20
+ }
21
+
22
+ @test()
23
+ @seed('homeIntegrations', 1)
24
+ protected async canReturnFirstHomeIntegration() {
25
+ const expected = await this.getFirstHomeIntegration()
26
+ const integrations = await this.emit()
27
+ assert.isLength(integrations, 1)
28
+ const first = integrations[0]
29
+ this.assertIntegrationEqualsExpected(first, expected)
30
+ }
31
+
32
+ @test()
33
+ @seed('homeIntegrations', 2)
34
+ protected async canReturnMultipleHomeIntegrations() {
35
+ const expected = await this.homeIntegrations.find(
36
+ {},
37
+ {},
38
+ { shouldIncludePrivateFields: true }
39
+ )
40
+ const integrations = await this.emit()
41
+ assert.isLength(integrations, 2)
42
+ this.assertIntegrationEqualsExpected(integrations[0], expected[0])
43
+ this.assertIntegrationEqualsExpected(integrations[1], expected[1])
44
+ }
45
+
46
+ private assertIntegrationEqualsExpected(
47
+ first: PublicHomeIntegration,
48
+ expected: HomeIntegration
49
+ ) {
50
+ assert.isEqual(first.id, expected.id)
51
+ assert.isEqual(first.name, expected.name)
52
+ assert.isEqual(first.description, expected.description)
53
+ }
54
+
55
+ private async emit() {
56
+ const [{ integrations }] =
57
+ await this.fakedClient.emitAndFlattenResponses(
58
+ 'google.list-home-integrations::v2025_02_08'
59
+ )
60
+
61
+ return integrations
62
+ }
63
+ }
@@ -0,0 +1,222 @@
1
+ import {
2
+ activeRecordCardAssert,
3
+ buttonAssert,
4
+ interactor,
5
+ MockActiveRecordCard,
6
+ vcAssert,
7
+ } from '@sprucelabs/heartwood-view-controllers'
8
+ import { eventFaker, fake } from '@sprucelabs/spruce-test-fixtures'
9
+ import { test, suite, generateId, assert } from '@sprucelabs/test-utils'
10
+ import { PublicHomeIntegration } from '../../google.types'
11
+ import RootSkillViewController from '../../skillViewControllers/Root.svc'
12
+ import AddHomeIntegrationCardViewController from '../../viewControllers/AddHomeIntegrationCard.vc'
13
+ import AbstractGoogleTest from '../support/AbstractGoogleTest'
14
+ import { DeleteHomeIntergrationTargetAndPayload } from '../support/EventFaker'
15
+ import SpyAddHomeIntegrationCard from './homeIntegrations/SpyAddHomeIntegrationCard'
16
+
17
+ @fake.login()
18
+ @suite()
19
+ export default class RootSkillViewTest extends AbstractGoogleTest {
20
+ private vc!: SpyRootSkillView
21
+ private fakedIntegrations: PublicHomeIntegration[] = []
22
+ protected names: string[] = []
23
+
24
+ protected async beforeEach(): Promise<void> {
25
+ await super.beforeEach()
26
+
27
+ this.fakedIntegrations = []
28
+ this.names = []
29
+
30
+ this.views.setController(
31
+ 'google.add-home-integration-card',
32
+ SpyAddHomeIntegrationCard
33
+ )
34
+ this.views.setController('active-record-card', MockActiveRecordCard)
35
+ this.views.setController('google.root', SpyRootSkillView)
36
+ this.vc = this.views.Controller('google.root', {}) as SpyRootSkillView
37
+
38
+ await this.eventFaker.fakeListHomeIntegrations(() => {
39
+ return this.fakedIntegrations
40
+ })
41
+
42
+ await this.eventFaker.fakeDeleteHomeIntegration()
43
+ }
44
+
45
+ @test()
46
+ protected async rendersACard() {
47
+ vcAssert.assertSkillViewRendersCard(this.vc, 'home-cloud-integrations')
48
+ }
49
+
50
+ @test()
51
+ protected async cardRendersList() {
52
+ activeRecordCardAssert.skillViewRendersActiveRecordCard(this.vc)
53
+ }
54
+
55
+ @test()
56
+ protected async requiresLogin() {
57
+ await vcAssert.assertLoginIsRequired(this.vc)
58
+ }
59
+
60
+ @test()
61
+ protected async returnsAListOfIntegrations() {
62
+ const integration = this.seedIntegration()
63
+ await this.load()
64
+ this.assertRendersIntegrationRow(integration.id)
65
+ }
66
+
67
+ @test()
68
+ protected async homeIntegrationsCardRendersExpectedButtons() {
69
+ buttonAssert.cardRendersButtons(this.homeIntegrationsCardVc, [
70
+ 'instructions',
71
+ 'add',
72
+ ])
73
+ }
74
+
75
+ @test()
76
+ protected async clickingAddIntegrationRendersDialog() {
77
+ await this.loadClickAddAndAssertRendersDialog()
78
+ }
79
+
80
+ @test()
81
+ protected async callingOnDoneInAddCardHidesDialog() {
82
+ const { addCardVc, dialogVc } =
83
+ await this.loadClickAddAndAssertRendersDialog()
84
+ await addCardVc.simulateClickDone()
85
+
86
+ assert.isFalse(dialogVc.getIsVisible())
87
+ }
88
+
89
+ @test()
90
+ protected async eachRowRendersDeleteButton() {
91
+ const integration = await this.seedOneIntegrationAndLoad()
92
+
93
+ this.homeIntegrationsCardVc.assertRowRendersButton(
94
+ integration.id,
95
+ 'delete'
96
+ )
97
+ }
98
+
99
+ @test()
100
+ protected async clickingDeleteButtonRendersAlert() {
101
+ await this.seedLoadClickDeleteAndAssertConfirm()
102
+ }
103
+
104
+ @test()
105
+ protected async clickingDeleteAndConfirmingRemovesRow() {
106
+ const integration = await this.seedLoadClickDeleteAndConfirm()
107
+ this.homeIntegrationsCardVc.assertDoesNotRenderRow(integration.id)
108
+ }
109
+
110
+ @test()
111
+ protected async doesNotRefreshListIfUserCancels() {
112
+ const int = await this.seedLoadClickDeleteAndDecline()
113
+
114
+ this.assertRendersIntegrationRow(int.id)
115
+ }
116
+
117
+ @test()
118
+ protected async confirmingDeleteShouldEmitDeleteEvent() {
119
+ let passedTarget:
120
+ | DeleteHomeIntergrationTargetAndPayload['target']
121
+ | undefined
122
+
123
+ await this.eventFaker.fakeDeleteHomeIntegration(({ target }) => {
124
+ passedTarget = target
125
+ })
126
+
127
+ const integration = await this.seedLoadClickDeleteAndConfirm()
128
+
129
+ assert.isEqualDeep(passedTarget, {
130
+ integrationId: integration.id,
131
+ })
132
+ }
133
+
134
+ @test()
135
+ protected async doesNotEmitEventIfDeclined() {
136
+ await eventFaker.makeEventThrow(
137
+ 'google.delete-home-integration::v2025_02_08'
138
+ )
139
+
140
+ await this.seedLoadClickDeleteAndDecline()
141
+ }
142
+
143
+ private async loadClickAddAndAssertRendersDialog() {
144
+ await this.load()
145
+ const dialogVc = await vcAssert.assertRendersDialog(this.vc, () =>
146
+ interactor.clickButton(this.homeIntegrationsCardVc, 'add')
147
+ )
148
+
149
+ const addCardVc = vcAssert.assertRendersAsInstanceOf(
150
+ dialogVc,
151
+ AddHomeIntegrationCardViewController
152
+ ) as SpyAddHomeIntegrationCard
153
+ return { dialogVc, addCardVc }
154
+ }
155
+
156
+ private async seedLoadClickDeleteAndConfirm() {
157
+ const { confirmVc, integration } =
158
+ await this.seedLoadClickDeleteAndAssertConfirm()
159
+
160
+ await confirmVc.accept()
161
+
162
+ return integration
163
+ }
164
+
165
+ private async seedLoadClickDeleteAndDecline() {
166
+ const { confirmVc, integration } =
167
+ await this.seedLoadClickDeleteAndAssertConfirm()
168
+
169
+ const int = integration
170
+
171
+ await confirmVc.decline()
172
+ return int
173
+ }
174
+
175
+ private assertRendersIntegrationRow(id: string) {
176
+ this.homeIntegrationsCardVc.assertRendersRow(id)
177
+ }
178
+
179
+ private async seedLoadClickDeleteAndAssertConfirm() {
180
+ const integration = await this.seedOneIntegrationAndLoad()
181
+
182
+ const confirmVc = await vcAssert.assertRendersConfirm(this.vc, () =>
183
+ interactor.clickButtonInRow(this.listVc, integration.id, 'delete')
184
+ )
185
+ return { confirmVc, integration }
186
+ }
187
+
188
+ private get listVc() {
189
+ return this.homeIntegrationsCardVc.getListVc()
190
+ }
191
+
192
+ private async seedOneIntegrationAndLoad() {
193
+ const integration = this.seedIntegration()
194
+ await this.load()
195
+ return integration
196
+ }
197
+
198
+ private seedIntegration() {
199
+ const integration: PublicHomeIntegration = {
200
+ description: generateId(),
201
+ id: generateId(),
202
+ name: generateId(),
203
+ }
204
+
205
+ this.fakedIntegrations.push(integration)
206
+ return integration
207
+ }
208
+
209
+ private async load() {
210
+ await this.views.load(this.vc)
211
+ }
212
+
213
+ private get homeIntegrationsCardVc() {
214
+ return this.vc.getHomeIntegrationsCardVc()
215
+ }
216
+ }
217
+
218
+ class SpyRootSkillView extends RootSkillViewController {
219
+ public getHomeIntegrationsCardVc() {
220
+ return this.activeRecordCardVc as MockActiveRecordCard
221
+ }
222
+ }
@@ -0,0 +1,34 @@
1
+ import { assertOptions } from '@sprucelabs/schema'
2
+ import { fake } from '@sprucelabs/spruce-test-fixtures'
3
+ import AbstractSpruceTest, {
4
+ test,
5
+ assert,
6
+ errorAssert,
7
+ } from '@sprucelabs/test-utils'
8
+
9
+ @fake.login()
10
+ export default class StaticTestFinderTest extends AbstractSpruceTest {
11
+ @test()
12
+ protected static async throwsWithMissing() {
13
+ const finder = StaticTestFinder.Finder()
14
+ const err = await assert.doesThrowAsync(() => finder.find())
15
+ errorAssert.assertError(err, 'MISSING_PARAMETERS', {
16
+ parameters: ['lookupDir'],
17
+ })
18
+ }
19
+
20
+ @test()
21
+ protected static async yourNextTest() {
22
+ assert.isTrue(false)
23
+ }
24
+ }
25
+
26
+ class StaticTestFinder {
27
+ public static Finder() {
28
+ return new this()
29
+ }
30
+
31
+ public async find() {
32
+ assertOptions({}, ['lookupDir'])
33
+ }
34
+ }
@@ -0,0 +1,62 @@
1
+ import { fake, seed } from '@sprucelabs/spruce-test-fixtures'
2
+ import { assert, test } from '@sprucelabs/test-utils'
3
+ import { HomeIntegration, PublicHomeIntegration } from '../../../google.types'
4
+ import AbstractGoogleTest from '../../support/AbstractGoogleTest'
5
+
6
+ @fake.login()
7
+ export default class ListHomeIntegrationsLIstenerTest extends AbstractGoogleTest {
8
+ protected static async beforeEach(): Promise<void> {
9
+ await super.beforeEach()
10
+ await this.bootSkill()
11
+ }
12
+
13
+ protected static async afterEach(): Promise<void> {
14
+ }
15
+
16
+ @test()
17
+ protected static async skillIsListening() {
18
+ await this.emit()
19
+ }
20
+
21
+ @test()
22
+ @seed('homeIntegrations', 1)
23
+ protected static async canReturnFirstHomeIntegration() {
24
+ const expected = await this.getFirstHomeIntegration()
25
+ const integrations = await this.emit()
26
+ assert.isLength(integrations, 1)
27
+ const first = integrations[0]
28
+ this.assertIntegrationEqualsExpected(first, expected)
29
+ }
30
+
31
+ @test()
32
+ @seed('homeIntegrations', 2)
33
+ protected static async canReturnMultipleHomeIntegrations() {
34
+ const expected = await this.homeIntegrations.find(
35
+ {},
36
+ {},
37
+ { shouldIncludePrivateFields: true }
38
+ )
39
+ const integrations = await this.emit()
40
+ assert.isLength(integrations, 2)
41
+ this.assertIntegrationEqualsExpected(integrations[0], expected[0])
42
+ this.assertIntegrationEqualsExpected(integrations[1], expected[1])
43
+ }
44
+
45
+ private static assertIntegrationEqualsExpected(
46
+ first: PublicHomeIntegration,
47
+ expected: HomeIntegration
48
+ ) {
49
+ assert.isEqual(first.id, expected.id)
50
+ assert.isEqual(first.name, expected.name)
51
+ assert.isEqual(first.description, expected.description)
52
+ }
53
+
54
+ private static async emit() {
55
+ const [{ integrations }] =
56
+ await this.fakedClient.emitAndFlattenResponses(
57
+ 'google.list-home-integrations::v2025_02_08'
58
+ )
59
+
60
+ return integrations
61
+ }
62
+ }