@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.
- package/CHANGELOG.md +33 -0
- package/LICENSE +21 -0
- package/build/__tests__/behavioral/DeployingToSandbox.test.d.ts +6 -1
- package/build/__tests__/behavioral/DeployingToSandbox.test.js +54 -35
- package/build/__tests__/behavioral/DeployingToSandbox.test.js.map +1 -1
- package/build/__tests__/behavioral/conversations/CreatingAConversationTopic.test.js +2 -2
- package/build/__tests__/behavioral/conversations/CreatingAConversationTopic.test.js.map +1 -1
- package/build/__tests__/behavioral/conversations/RegisteringConversationsOnBoot.test.js +1 -1
- package/build/__tests__/behavioral/conversations/RegisteringConversationsOnBoot.test.js.map +1 -1
- package/build/__tests__/behavioral/conversations/TestingAConversation.test.js +5 -5
- package/build/__tests__/behavioral/conversations/TestingAConversation.test.js.map +1 -1
- package/build/__tests__/behavioral/organization/CreatingAnOrg.test.js.map +1 -1
- package/build/__tests__/behavioral/schemas/CreatingSchemasWithGenerics.test.js +1 -1
- package/build/__tests__/behavioral/schemas/CreatingSchemasWithGenerics.test.js.map +1 -1
- package/build/__tests__/behavioral/tests/migrationToInstance/AbstractInstanceTest.d.ts +11 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/AbstractInstanceTest.js +49 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/AbstractInstanceTest.js.map +1 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/InstanceBasedTesting.test.d.ts +5 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/InstanceBasedTesting.test.js +34 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/InstanceBasedTesting.test.js.map +1 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/MigratingTests.test.d.ts +12 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/MigratingTests.test.js +88 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/MigratingTests.test.js.map +1 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticTestFinder.test.d.ts +13 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticTestFinder.test.js +109 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticTestFinder.test.js.map +1 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticTestsWhenAlreadyExists.test.d.ts +4 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticTestsWhenAlreadyExists.test.js +29 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticTestsWhenAlreadyExists.test.js.map +1 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceMigrator.test.d.ts +26 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceMigrator.test.js +259 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceMigrator.test.js.map +1 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceTestFileMigrator.test.d.ts +26 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceTestFileMigrator.test.js +202 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceTestFileMigrator.test.js.map +1 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/support/AbstractInstanceTest.txt +24 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/support/AbstractStaticTest.txt +24 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/support/InstanceTest.txt +36 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/support/InstanceTest2.txt +63 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/support/InstanceTest3.txt +222 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/support/StaticTest.txt +34 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/support/StaticTest2.txt +62 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/support/StaticTest3.txt +221 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/testFileContentsGenerators.d.ts +2 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/testFileContentsGenerators.js +51 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/testFileContentsGenerators.js.map +1 -0
- package/build/__tests__/behavioral/versions/ResolvingVersions.test.js +0 -3
- package/build/__tests__/behavioral/versions/ResolvingVersions.test.js.map +1 -1
- package/build/__tests__/implementation/OrganizationStore.test.js +2 -2
- package/build/__tests__/implementation/OrganizationStore.test.js.map +1 -1
- package/build/__tests__/implementation/TerminalInterface.test.d.ts +1 -0
- package/build/__tests__/implementation/TerminalInterface.test.js +6 -0
- package/build/__tests__/implementation/TerminalInterface.test.js.map +1 -1
- package/build/__tests__/testDirsAndFiles/static_test_migration_1/src/__tests__/AnotherStaticTest.test.ts +33 -0
- package/build/__tests__/testDirsAndFiles/static_test_migration_1/src/__tests__/ShouldBeIgnored.ts +0 -0
- package/build/__tests__/testDirsAndFiles/static_test_migration_1/src/__tests__/StaticTest1.test.ts +33 -0
- package/build/__tests__/testDirsAndFiles/static_test_migration_2/src/DoNotInclude.ts +0 -0
- package/build/__tests__/testDirsAndFiles/static_test_migration_2/src/__tests__/AStaticTest.test.ts +33 -0
- package/build/__tests__/testDirsAndFiles/static_test_migration_2/src/__tests__/AnotherStaticTest1.test.ts +33 -0
- package/build/__tests__/testDirsAndFiles/static_test_migration_3/NotAFileThatShouldBeMigrated.ts +0 -0
- package/build/__tests__/testDirsAndFiles/static_test_migration_3/src/__tests__/AStaticTest2.test.ts +17 -0
- package/build/__tests__/testDirsAndFiles/static_test_migration_3/src/__tests__/AbstractWhateverTest.ts +3 -0
- package/build/errors/SpruceError.js +1 -1
- package/build/errors/SpruceError.js.map +1 -1
- package/build/features/skill/actions/LoginAction.js +1 -2
- package/build/features/skill/actions/LoginAction.js.map +1 -1
- package/build/features/test/actions/CreateAction.d.ts +1 -0
- package/build/features/test/actions/CreateAction.js +13 -0
- package/build/features/test/actions/CreateAction.js.map +1 -1
- package/build/features/test/actions/MigrateAction.d.ts +17 -0
- package/build/features/test/actions/MigrateAction.js +39 -0
- package/build/features/test/actions/MigrateAction.js.map +1 -0
- package/build/index.js +0 -0
- package/build/tests/staticToInstanceMigration/StaticTestFinder.d.ts +8 -0
- package/build/tests/staticToInstanceMigration/StaticTestFinder.js +23 -0
- package/build/tests/staticToInstanceMigration/StaticTestFinder.js.map +1 -0
- package/build/tests/staticToInstanceMigration/StaticToInstanceMigrator.d.ts +58 -0
- package/build/tests/staticToInstanceMigration/StaticToInstanceMigrator.js +48 -0
- package/build/tests/staticToInstanceMigration/StaticToInstanceMigrator.js.map +1 -0
- package/build/tests/staticToInstanceMigration/StaticToInstanceTestFileMigrator.d.ts +12 -0
- package/build/tests/staticToInstanceMigration/StaticToInstanceTestFileMigrator.js +138 -0
- package/build/tests/staticToInstanceMigration/StaticToInstanceTestFileMigrator.js.map +1 -0
- package/build/utilities/isCi.js +1 -1
- package/build/utilities/isCi.js.map +1 -1
- package/package.json +28 -45
- package/src/__tests__/behavioral/DeployingToSandbox.test.ts +77 -44
- package/src/__tests__/behavioral/conversations/CreatingAConversationTopic.test.ts +2 -2
- package/src/__tests__/behavioral/conversations/RegisteringConversationsOnBoot.test.ts +1 -1
- package/src/__tests__/behavioral/conversations/TestingAConversation.test.ts +5 -5
- package/src/__tests__/behavioral/organization/CreatingAnOrg.test.ts +0 -1
- package/src/__tests__/behavioral/schemas/CreatingSchemasWithGenerics.test.ts +2 -1
- package/src/__tests__/behavioral/tests/migrationToInstance/AbstractInstanceTest.ts +77 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/InstanceBasedTesting.test.ts +19 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/MigratingTests.test.ts +99 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/StaticTestFinder.test.ts +72 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/StaticTestsWhenAlreadyExists.test.ts +31 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceMigrator.test.ts +252 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceTestFileMigrator.test.ts +193 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/support/AbstractInstanceTest.txt +24 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/support/AbstractStaticTest.txt +24 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/support/InstanceTest.txt +36 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/support/InstanceTest2.txt +63 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/support/InstanceTest3.txt +222 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/support/StaticTest.txt +34 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/support/StaticTest2.txt +62 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/support/StaticTest3.txt +221 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/testFileContentsGenerators.ts +50 -0
- package/src/__tests__/behavioral/versions/ResolvingVersions.test.ts +1 -3
- package/src/__tests__/implementation/OrganizationStore.test.ts +6 -2
- package/src/__tests__/implementation/TerminalInterface.test.ts +9 -0
- package/src/__tests__/testDirsAndFiles/static_test_migration_1/src/__tests__/AnotherStaticTest.test.ts +33 -0
- package/src/__tests__/testDirsAndFiles/static_test_migration_1/src/__tests__/ShouldBeIgnored.ts +0 -0
- package/src/__tests__/testDirsAndFiles/static_test_migration_1/src/__tests__/StaticTest1.test.ts +33 -0
- package/src/__tests__/testDirsAndFiles/static_test_migration_2/src/DoNotInclude.ts +0 -0
- package/src/__tests__/testDirsAndFiles/static_test_migration_2/src/__tests__/AStaticTest.test.ts +33 -0
- package/src/__tests__/testDirsAndFiles/static_test_migration_2/src/__tests__/AnotherStaticTest1.test.ts +33 -0
- package/src/__tests__/testDirsAndFiles/static_test_migration_3/NotAFileThatShouldBeMigrated.ts +0 -0
- package/src/__tests__/testDirsAndFiles/static_test_migration_3/src/__tests__/AStaticTest2.test.ts +17 -0
- package/src/__tests__/testDirsAndFiles/static_test_migration_3/src/__tests__/AbstractWhateverTest.ts +3 -0
- package/src/errors/SpruceError.ts +1 -1
- package/src/features/skill/actions/LoginAction.ts +8 -7
- package/src/features/test/actions/CreateAction.ts +17 -0
- package/src/features/test/actions/MigrateAction.ts +41 -0
- package/src/tests/staticToInstanceMigration/StaticTestFinder.ts +25 -0
- package/src/tests/staticToInstanceMigration/StaticToInstanceMigrator.ts +73 -0
- package/src/tests/staticToInstanceMigration/StaticToInstanceTestFileMigrator.ts +197 -0
- package/src/utilities/isCi.ts +1 -1
- package/.DS_Store +0 -0
- package/.env +0 -25
- package/.env-dev +0 -24
- package/.eslintcache +0 -1
- package/dist/spruce-darwin-arm64 +0 -0
- package/dist/spruce-linux-arm64 +0 -0
- package/junit.xml +0 -42
- package/yarn-error.log +0 -597
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import AbstractSpruceTest from '@sprucelabs/test-utils';
|
|
2
|
+
export default class StaticTestFinderTest extends AbstractSpruceTest {
|
|
3
|
+
private finder;
|
|
4
|
+
private testPath?;
|
|
5
|
+
protected throwsWithMissing(): Promise<void>;
|
|
6
|
+
protected matchesStaticTests1(): Promise<void>;
|
|
7
|
+
protected matchesStaticTests2(): Promise<void>;
|
|
8
|
+
protected includesAbstractTestsInOtherDirectories(): Promise<void>;
|
|
9
|
+
private assertFindResultsEqual;
|
|
10
|
+
private find;
|
|
11
|
+
private resolveStaticTestFile;
|
|
12
|
+
private setTestMigrationDir;
|
|
13
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
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 test_utils_1 = __importStar(require("@sprucelabs/test-utils"));
|
|
46
|
+
const StaticTestFinder_1 = __importDefault(require("../../../../tests/staticToInstanceMigration/StaticTestFinder"));
|
|
47
|
+
let StaticTestFinderTest = class StaticTestFinderTest extends test_utils_1.default {
|
|
48
|
+
finder = StaticTestFinder_1.default.Finder();
|
|
49
|
+
testPath;
|
|
50
|
+
async throwsWithMissing() {
|
|
51
|
+
//@ts-ignore
|
|
52
|
+
const err = await test_utils_1.assert.doesThrowAsync(() => this.finder.find());
|
|
53
|
+
test_utils_1.errorAssert.assertError(err, 'MISSING_PARAMETERS', {
|
|
54
|
+
parameters: ['lookupDir'],
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
async matchesStaticTests1() {
|
|
58
|
+
this.setTestMigrationDir('static_test_migration_1');
|
|
59
|
+
await this.assertFindResultsEqual([
|
|
60
|
+
'AnotherStaticTest.test.ts',
|
|
61
|
+
'StaticTest1.test.ts',
|
|
62
|
+
]);
|
|
63
|
+
}
|
|
64
|
+
async matchesStaticTests2() {
|
|
65
|
+
this.setTestMigrationDir('static_test_migration_2');
|
|
66
|
+
await this.assertFindResultsEqual([
|
|
67
|
+
'AStaticTest.test.ts',
|
|
68
|
+
'AnotherStaticTest1.test.ts',
|
|
69
|
+
]);
|
|
70
|
+
}
|
|
71
|
+
async includesAbstractTestsInOtherDirectories() {
|
|
72
|
+
this.setTestMigrationDir('static_test_migration_3');
|
|
73
|
+
await this.assertFindResultsEqual([
|
|
74
|
+
'AbstractWhateverTest.ts',
|
|
75
|
+
'AStaticTest2.test.ts',
|
|
76
|
+
]);
|
|
77
|
+
}
|
|
78
|
+
async assertFindResultsEqual(files) {
|
|
79
|
+
const results = await this.find();
|
|
80
|
+
const expected = files.map((file) => this.resolveStaticTestFile(file));
|
|
81
|
+
test_utils_1.assert.isEqualDeep(results, expected);
|
|
82
|
+
}
|
|
83
|
+
async find() {
|
|
84
|
+
return await this.finder.find(this.testPath);
|
|
85
|
+
}
|
|
86
|
+
resolveStaticTestFile(file) {
|
|
87
|
+
return this.resolvePath(this.testPath, 'src', '__tests__', file);
|
|
88
|
+
}
|
|
89
|
+
setTestMigrationDir(dirName) {
|
|
90
|
+
this.testPath = this.resolvePath('build', '__tests__', 'testDirsAndFiles', dirName);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
__decorate([
|
|
94
|
+
(0, test_utils_1.test)()
|
|
95
|
+
], StaticTestFinderTest.prototype, "throwsWithMissing", null);
|
|
96
|
+
__decorate([
|
|
97
|
+
(0, test_utils_1.test)()
|
|
98
|
+
], StaticTestFinderTest.prototype, "matchesStaticTests1", null);
|
|
99
|
+
__decorate([
|
|
100
|
+
(0, test_utils_1.test)()
|
|
101
|
+
], StaticTestFinderTest.prototype, "matchesStaticTests2", null);
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, test_utils_1.test)()
|
|
104
|
+
], StaticTestFinderTest.prototype, "includesAbstractTestsInOtherDirectories", null);
|
|
105
|
+
StaticTestFinderTest = __decorate([
|
|
106
|
+
(0, test_utils_1.suite)()
|
|
107
|
+
], StaticTestFinderTest);
|
|
108
|
+
exports.default = StaticTestFinderTest;
|
|
109
|
+
//# sourceMappingURL=StaticTestFinder.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StaticTestFinder.test.js","sourceRoot":"","sources":["../../../../../src/__tests__/behavioral/tests/migrationToInstance/StaticTestFinder.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qEAK+B;AAC/B,oHAA+F;AAGhF,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,oBAAkB;IACxD,MAAM,GAAyB,0BAAoB,CAAC,MAAM,EAAE,CAAA;IAC5D,QAAQ,CAAS;IAGT,AAAN,KAAK,CAAC,iBAAiB;QAC7B,YAAY;QACZ,MAAM,GAAG,GAAG,MAAM,mBAAM,CAAC,cAAc,CAAC,GAAG,EA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,QAAS,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,CAAC,CAAA;IACrE,CAAC;IAEO,mBAAmB,CAAC,OAAe;QACvC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,WAAW,CAC5B,OAAO,EACP,WAAW,EACX,kBAAkB,EAClB,OAAO,CACV,CAAA;IACL,CAAC;CACJ,CAAA;AAzDmB;IADf,IAAA,iBAAI,GAAE;6DAON;AAGe;IADf,IAAA,iBAAI,GAAE;+DAON;AAGe;IADf,IAAA,iBAAI,GAAE;+DAON;AAGe;IADf,IAAA,iBAAI,GAAE;mFAON;AAtCgB,oBAAoB;IADxC,IAAA,kBAAK,GAAE;GACa,oBAAoB,CA8DxC;kBA9DoB,oBAAoB"}
|
package/build/__tests__/behavioral/tests/migrationToInstance/StaticTestsWhenAlreadyExists.test.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const spruce_skill_utils_1 = require("@sprucelabs/spruce-skill-utils");
|
|
13
|
+
const test_utils_1 = require("@sprucelabs/test-utils");
|
|
14
|
+
const AbstractInstanceTest_1 = __importDefault(require("./AbstractInstanceTest"));
|
|
15
|
+
const testFileContentsGenerators_1 = require("./testFileContentsGenerators");
|
|
16
|
+
class StaticTestsWhenAlreadyExistsTest extends AbstractInstanceTest_1.default {
|
|
17
|
+
static async canCreateStaticTestsWhenAlreadyExists() {
|
|
18
|
+
const testFile = await this.createTestAndGetCreatedFilePath('AFirstTest');
|
|
19
|
+
spruce_skill_utils_1.diskUtil.writeFile(testFile, (0, testFileContentsGenerators_1.generateExpectedStaticTestContents)('AFirstTest'));
|
|
20
|
+
await this.createTestAndAssertContentsEqual('ASecondTest', (0, testFileContentsGenerators_1.generateExpectedStaticTestContents)('ASecondTest'), true);
|
|
21
|
+
spruce_skill_utils_1.diskUtil.deleteFile(testFile);
|
|
22
|
+
await this.createTestAndAssertContentsEqual('AThirdTest', (0, testFileContentsGenerators_1.generateExpectedStaticTestContents)('AThirdTest'), true);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.default = StaticTestsWhenAlreadyExistsTest;
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, test_utils_1.test)()
|
|
28
|
+
], StaticTestsWhenAlreadyExistsTest, "canCreateStaticTestsWhenAlreadyExists", null);
|
|
29
|
+
//# sourceMappingURL=StaticTestsWhenAlreadyExists.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StaticTestsWhenAlreadyExists.test.js","sourceRoot":"","sources":["../../../../../src/__tests__/behavioral/tests/migrationToInstance/StaticTestsWhenAlreadyExists.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,uEAAyD;AACzD,uDAA6C;AAC7C,kFAAyD;AACzD,6EAAiF;AAEjF,MAAqB,gCAAiC,SAAQ,8BAAoB;IAEvD,AAAb,MAAM,CAAC,KAAK,CAAC,qCAAqC;QACxD,MAAM,QAAQ,GACV,MAAM,IAAI,CAAC,+BAA+B,CAAC,YAAY,CAAC,CAAA;QAE5D,6BAAQ,CAAC,SAAS,CACd,QAAQ,EACR,IAAA,+DAAkC,EAAC,YAAY,CAAC,CACnD,CAAA;QAED,MAAM,IAAI,CAAC,gCAAgC,CACvC,aAAa,EACb,IAAA,+DAAkC,EAAC,aAAa,CAAC,EACjD,IAAI,CACP,CAAA;QAED,6BAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;QAE7B,MAAM,IAAI,CAAC,gCAAgC,CACvC,YAAY,EACZ,IAAA,+DAAkC,EAAC,YAAY,CAAC,EAChD,IAAI,CACP,CAAA;IACL,CAAC;CACJ;AAzBD,mDAyBC;AAvB0B;IADtB,IAAA,iBAAI,GAAE;mFAuBN"}
|
package/build/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceMigrator.test.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import AbstractSpruceTest from '@sprucelabs/test-utils';
|
|
2
|
+
export default class StaticToInstanceMigratorTest extends AbstractSpruceTest {
|
|
3
|
+
private testFinder;
|
|
4
|
+
private testFileMigrator;
|
|
5
|
+
private migrator;
|
|
6
|
+
private readFiles;
|
|
7
|
+
private fakedFileContents;
|
|
8
|
+
private lastWrittenFile?;
|
|
9
|
+
constructor();
|
|
10
|
+
protected throwsWithMissing(): void;
|
|
11
|
+
protected runThrowsWithMissing(): Promise<void>;
|
|
12
|
+
protected passesLookupDirToTestFinder(): Promise<void>;
|
|
13
|
+
protected returnsStatsBasedOnTestsFound(results: string[]): Promise<void>;
|
|
14
|
+
protected passesOneFilesContentsToMigrator(filename: string): Promise<void>;
|
|
15
|
+
protected passesResultsOfFileToMigrator(): Promise<void>;
|
|
16
|
+
protected passesResultsOfMultipleFilesToMigrator(): Promise<void>;
|
|
17
|
+
protected writesResponseOfMigrate(): Promise<void>;
|
|
18
|
+
protected returnsSkippedIfMigratedIsTheSame(): Promise<void>;
|
|
19
|
+
protected countsSkippedAndMatched(): Promise<void>;
|
|
20
|
+
protected doesNotWriteFileThatDidNotChange(): Promise<void>;
|
|
21
|
+
private setMigrateFileResponse;
|
|
22
|
+
private assertContentsPassedToFileMigratorEquals;
|
|
23
|
+
private setFakedFileContents;
|
|
24
|
+
private setFakedFinderResults;
|
|
25
|
+
private run;
|
|
26
|
+
}
|
|
@@ -0,0 +1,259 @@
|
|
|
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 test_utils_1 = __importStar(require("@sprucelabs/test-utils"));
|
|
46
|
+
const StaticTestFinder_1 = __importDefault(require("../../../../tests/staticToInstanceMigration/StaticTestFinder"));
|
|
47
|
+
const StaticToInstanceMigrator_1 = __importDefault(require("../../../../tests/staticToInstanceMigration/StaticToInstanceMigrator"));
|
|
48
|
+
const StaticToInstanceTestFileMigrator_1 = __importDefault(require("../../../../tests/staticToInstanceMigration/StaticToInstanceTestFileMigrator"));
|
|
49
|
+
let StaticToInstanceMigratorTest = class StaticToInstanceMigratorTest extends test_utils_1.default {
|
|
50
|
+
testFinder;
|
|
51
|
+
testFileMigrator;
|
|
52
|
+
migrator;
|
|
53
|
+
readFiles = [];
|
|
54
|
+
fakedFileContents = {};
|
|
55
|
+
lastWrittenFile;
|
|
56
|
+
constructor() {
|
|
57
|
+
super();
|
|
58
|
+
StaticTestFinder_1.default.Class = FakeStaticTestFinder;
|
|
59
|
+
StaticToInstanceTestFileMigrator_1.default.Class = FakeFileMigrator;
|
|
60
|
+
StaticToInstanceMigrator_1.default.diskUtil.readFile = (source) => {
|
|
61
|
+
this.readFiles.push(source);
|
|
62
|
+
return this.fakedFileContents[source] ?? (0, test_utils_1.generateId)();
|
|
63
|
+
};
|
|
64
|
+
StaticToInstanceMigrator_1.default.diskUtil.writeFile = (destination, contents) => {
|
|
65
|
+
this.lastWrittenFile = {
|
|
66
|
+
destination,
|
|
67
|
+
contents,
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
this.testFinder = StaticTestFinder_1.default.Finder();
|
|
71
|
+
this.testFileMigrator =
|
|
72
|
+
StaticToInstanceTestFileMigrator_1.default.Migrator();
|
|
73
|
+
this.migrator = StaticToInstanceMigrator_1.default.Migrator({
|
|
74
|
+
testFinder: this.testFinder,
|
|
75
|
+
testFileMigrator: this.testFileMigrator,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
throwsWithMissing() {
|
|
79
|
+
const err = test_utils_1.assert.doesThrow(() =>
|
|
80
|
+
//@ts-ignore
|
|
81
|
+
StaticToInstanceMigrator_1.default.Migrator());
|
|
82
|
+
test_utils_1.errorAssert.assertError(err, 'MISSING_PARAMETERS', {
|
|
83
|
+
parameters: ['testFinder', 'testFileMigrator'],
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
async runThrowsWithMissing() {
|
|
87
|
+
//@ts-ignore
|
|
88
|
+
const err = await test_utils_1.assert.doesThrowAsync(() => this.migrator.run());
|
|
89
|
+
test_utils_1.errorAssert.assertError(err, 'MISSING_PARAMETERS', {
|
|
90
|
+
parameters: ['lookupDir'],
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
async passesLookupDirToTestFinder() {
|
|
94
|
+
const path = (0, test_utils_1.generateId)();
|
|
95
|
+
await this.run(path);
|
|
96
|
+
test_utils_1.assert.isEqual(this.testFinder.lastLookupDir, path);
|
|
97
|
+
}
|
|
98
|
+
async returnsStatsBasedOnTestsFound(results) {
|
|
99
|
+
this.setFakedFinderResults(results);
|
|
100
|
+
const stats = await this.run();
|
|
101
|
+
test_utils_1.assert.isEqualDeep(stats, {
|
|
102
|
+
totalTestsUpdated: this.testFinder.fakedResults.length,
|
|
103
|
+
totalTestsSkipped: 0,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
async passesOneFilesContentsToMigrator(filename) {
|
|
107
|
+
this.setFakedFinderResults([filename]);
|
|
108
|
+
await this.run();
|
|
109
|
+
test_utils_1.assert.isEqualDeep(this.readFiles, [filename]);
|
|
110
|
+
}
|
|
111
|
+
async passesResultsOfFileToMigrator() {
|
|
112
|
+
this.setFakedFinderResults(['a']);
|
|
113
|
+
this.setFakedFileContents({
|
|
114
|
+
a: (0, test_utils_1.generateId)(),
|
|
115
|
+
});
|
|
116
|
+
await this.run();
|
|
117
|
+
this.assertContentsPassedToFileMigratorEquals([
|
|
118
|
+
this.fakedFileContents['a'],
|
|
119
|
+
]);
|
|
120
|
+
}
|
|
121
|
+
async passesResultsOfMultipleFilesToMigrator() {
|
|
122
|
+
const contents1 = (0, test_utils_1.generateId)();
|
|
123
|
+
const contents2 = (0, test_utils_1.generateId)();
|
|
124
|
+
this.setFakedFinderResults(['what', 'the']);
|
|
125
|
+
this.setFakedFileContents({
|
|
126
|
+
what: contents1,
|
|
127
|
+
the: contents2,
|
|
128
|
+
});
|
|
129
|
+
await this.run();
|
|
130
|
+
this.assertContentsPassedToFileMigratorEquals([contents1, contents2]);
|
|
131
|
+
}
|
|
132
|
+
async writesResponseOfMigrate() {
|
|
133
|
+
const filename = (0, test_utils_1.generateId)();
|
|
134
|
+
this.setFakedFinderResults([filename]);
|
|
135
|
+
this.setFakedFileContents({
|
|
136
|
+
[filename]: (0, test_utils_1.generateId)(),
|
|
137
|
+
});
|
|
138
|
+
await this.run();
|
|
139
|
+
test_utils_1.assert.isEqualDeep(this.lastWrittenFile, {
|
|
140
|
+
destination: filename,
|
|
141
|
+
contents: this.testFileMigrator.fakedMigrateResponse,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
async returnsSkippedIfMigratedIsTheSame() {
|
|
145
|
+
this.setFakedFinderResults(['a']);
|
|
146
|
+
const contents = (0, test_utils_1.generateId)();
|
|
147
|
+
this.setFakedFileContents({
|
|
148
|
+
a: contents,
|
|
149
|
+
});
|
|
150
|
+
this.setMigrateFileResponse(contents);
|
|
151
|
+
const stats = await this.run();
|
|
152
|
+
test_utils_1.assert.isEqualDeep(stats, {
|
|
153
|
+
totalTestsUpdated: 0,
|
|
154
|
+
totalTestsSkipped: 1,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
async countsSkippedAndMatched() {
|
|
158
|
+
const contents1 = (0, test_utils_1.generateId)();
|
|
159
|
+
const contents2 = (0, test_utils_1.generateId)();
|
|
160
|
+
this.setFakedFinderResults(['what', 'the', 'heck']);
|
|
161
|
+
this.setFakedFileContents({
|
|
162
|
+
what: contents1,
|
|
163
|
+
the: contents2,
|
|
164
|
+
heck: (0, test_utils_1.generateId)(),
|
|
165
|
+
});
|
|
166
|
+
this.testFileMigrator.fakedMigrateResponsesByContents = {
|
|
167
|
+
[contents1]: contents1,
|
|
168
|
+
[contents2]: contents2,
|
|
169
|
+
};
|
|
170
|
+
const stats = await this.run();
|
|
171
|
+
test_utils_1.assert.isEqualDeep(stats, {
|
|
172
|
+
totalTestsUpdated: 1,
|
|
173
|
+
totalTestsSkipped: 2,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
async doesNotWriteFileThatDidNotChange() {
|
|
177
|
+
this.setFakedFinderResults(['a']);
|
|
178
|
+
const contents = (0, test_utils_1.generateId)();
|
|
179
|
+
this.setFakedFileContents({
|
|
180
|
+
a: contents,
|
|
181
|
+
});
|
|
182
|
+
this.setMigrateFileResponse(contents);
|
|
183
|
+
await this.run();
|
|
184
|
+
test_utils_1.assert.isUndefined(this.lastWrittenFile);
|
|
185
|
+
}
|
|
186
|
+
setMigrateFileResponse(contents) {
|
|
187
|
+
this.testFileMigrator.fakedMigrateResponse = contents;
|
|
188
|
+
}
|
|
189
|
+
assertContentsPassedToFileMigratorEquals(expected) {
|
|
190
|
+
test_utils_1.assert.isEqualDeep(this.testFileMigrator.contentsPassedToMigrate, expected);
|
|
191
|
+
}
|
|
192
|
+
setFakedFileContents(contents) {
|
|
193
|
+
this.fakedFileContents = contents;
|
|
194
|
+
}
|
|
195
|
+
setFakedFinderResults(results) {
|
|
196
|
+
this.testFinder.fakedResults = results;
|
|
197
|
+
}
|
|
198
|
+
async run(path) {
|
|
199
|
+
return await this.migrator.run(path ?? (0, test_utils_1.generateId)());
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
__decorate([
|
|
203
|
+
(0, test_utils_1.test)()
|
|
204
|
+
], StaticToInstanceMigratorTest.prototype, "throwsWithMissing", null);
|
|
205
|
+
__decorate([
|
|
206
|
+
(0, test_utils_1.test)()
|
|
207
|
+
], StaticToInstanceMigratorTest.prototype, "runThrowsWithMissing", null);
|
|
208
|
+
__decorate([
|
|
209
|
+
(0, test_utils_1.test)()
|
|
210
|
+
], StaticToInstanceMigratorTest.prototype, "passesLookupDirToTestFinder", null);
|
|
211
|
+
__decorate([
|
|
212
|
+
(0, test_utils_1.test)('returns stats based on 3 tests found', ['a', 'b', 'c']),
|
|
213
|
+
(0, test_utils_1.test)('returns stats based on 0 tests found', [])
|
|
214
|
+
], StaticToInstanceMigratorTest.prototype, "returnsStatsBasedOnTestsFound", null);
|
|
215
|
+
__decorate([
|
|
216
|
+
(0, test_utils_1.test)('passes one files contents to migrator', 'a'),
|
|
217
|
+
(0, test_utils_1.test)('passes another files contents to migrator', 'b')
|
|
218
|
+
], StaticToInstanceMigratorTest.prototype, "passesOneFilesContentsToMigrator", null);
|
|
219
|
+
__decorate([
|
|
220
|
+
(0, test_utils_1.test)()
|
|
221
|
+
], StaticToInstanceMigratorTest.prototype, "passesResultsOfFileToMigrator", null);
|
|
222
|
+
__decorate([
|
|
223
|
+
(0, test_utils_1.test)()
|
|
224
|
+
], StaticToInstanceMigratorTest.prototype, "passesResultsOfMultipleFilesToMigrator", null);
|
|
225
|
+
__decorate([
|
|
226
|
+
(0, test_utils_1.test)()
|
|
227
|
+
], StaticToInstanceMigratorTest.prototype, "writesResponseOfMigrate", null);
|
|
228
|
+
__decorate([
|
|
229
|
+
(0, test_utils_1.test)()
|
|
230
|
+
], StaticToInstanceMigratorTest.prototype, "returnsSkippedIfMigratedIsTheSame", null);
|
|
231
|
+
__decorate([
|
|
232
|
+
(0, test_utils_1.test)()
|
|
233
|
+
], StaticToInstanceMigratorTest.prototype, "countsSkippedAndMatched", null);
|
|
234
|
+
__decorate([
|
|
235
|
+
(0, test_utils_1.test)()
|
|
236
|
+
], StaticToInstanceMigratorTest.prototype, "doesNotWriteFileThatDidNotChange", null);
|
|
237
|
+
StaticToInstanceMigratorTest = __decorate([
|
|
238
|
+
(0, test_utils_1.suite)()
|
|
239
|
+
], StaticToInstanceMigratorTest);
|
|
240
|
+
exports.default = StaticToInstanceMigratorTest;
|
|
241
|
+
class FakeStaticTestFinder {
|
|
242
|
+
lastLookupDir;
|
|
243
|
+
fakedResults = [];
|
|
244
|
+
async find(lookupDir) {
|
|
245
|
+
this.lastLookupDir = lookupDir;
|
|
246
|
+
return this.fakedResults;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
class FakeFileMigrator {
|
|
250
|
+
contentsPassedToMigrate = [];
|
|
251
|
+
fakedMigrateResponse = (0, test_utils_1.generateId)();
|
|
252
|
+
fakedMigrateResponsesByContents = {};
|
|
253
|
+
migrate(contents) {
|
|
254
|
+
this.contentsPassedToMigrate.push(contents);
|
|
255
|
+
return (this.fakedMigrateResponsesByContents[contents] ??
|
|
256
|
+
this.fakedMigrateResponse);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
//# sourceMappingURL=StaticToInstanceMigrator.test.js.map
|
package/build/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceMigrator.test.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StaticToInstanceMigrator.test.js","sourceRoot":"","sources":["../../../../../src/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceMigrator.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;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CAA2C,EAAE,GAAG,CAAC;oFAKtD;AAGe;IADf,IAAA,iBAAI,GAAE;iFAWN;AAGe;IADf,IAAA,iBAAI,GAAE;0FAeN;AAGe;IADf,IAAA,iBAAI,GAAE;2EAeN;AAGe;IADf,IAAA,iBAAI,GAAE;qFAeN;AAGe;IADf,IAAA,iBAAI,GAAE;2EAsBN;AAGe;IADf,IAAA,iBAAI,GAAE;oFAYN;AAzLgB,4BAA4B;IADhD,IAAA,kBAAK,GAAE;GACa,4BAA4B,CAiNhD;kBAjNoB,4BAA4B;AAmNjD,MAAM,oBAAoB;IACf,aAAa,CAAS;IACtB,YAAY,GAAa,EAAE,CAAA;IAE3B,KAAK,CAAC,IAAI,CAAC,SAAiB;QAC/B,IAAI,CAAC,aAAa,GAAG,SAAS,CAAA;QAC9B,OAAO,IAAI,CAAC,YAAY,CAAA;IAC5B,CAAC;CACJ;AAED,MAAM,gBAAgB;IACX,uBAAuB,GAAa,EAAE,CAAA;IACtC,oBAAoB,GAAG,IAAA,uBAAU,GAAE,CAAA;IACnC,+BAA+B,GAA2B,EAAE,CAAA;IAE5D,OAAO,CAAC,QAAgB;QAC3B,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAC3C,OAAO,CACH,IAAI,CAAC,+BAA+B,CAAC,QAAQ,CAAC;YAC9C,IAAI,CAAC,oBAAoB,CAC5B,CAAA;IACL,CAAC;CACJ"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import AbstractSpruceTest from '@sprucelabs/test-utils';
|
|
2
|
+
export default class StaticToInstanceTestFileMigratorTest extends AbstractSpruceTest {
|
|
3
|
+
private migrator;
|
|
4
|
+
protected throwsWithMissing(): void;
|
|
5
|
+
protected returnsEmptyString(): void;
|
|
6
|
+
protected fixesStaticFunction(): void;
|
|
7
|
+
protected fixesStaticAsyncFunctions(): void;
|
|
8
|
+
protected doesNotMessWithStaticInVariableName(): void;
|
|
9
|
+
protected addsSuiteDecoratorToClassIfNotThere(): void;
|
|
10
|
+
protected doesNotAddSuitIfAnotherClassExported(): void;
|
|
11
|
+
protected doesNotAddSuiteIfAlreadyThere(): void;
|
|
12
|
+
protected addsImportIfNotThere(): void;
|
|
13
|
+
protected doesNotMessWithAnythingWithTestInName(): void;
|
|
14
|
+
protected doesNoIncludeSuiteTwice(): void;
|
|
15
|
+
protected includesSuiteEvenIfSuiteIsInAMethodName(): void;
|
|
16
|
+
protected includesSuiteWithMultipleImports(): void;
|
|
17
|
+
protected canMigrateWholeTest(): void;
|
|
18
|
+
protected properlyMigrationsAbstractTests(): void;
|
|
19
|
+
protected canMigrateMoreComplexTest(): void;
|
|
20
|
+
protected canMigrateAnotherComplexTest(): void;
|
|
21
|
+
private readTestFile;
|
|
22
|
+
private resolveTestClassPath;
|
|
23
|
+
private assertMigratedEquals;
|
|
24
|
+
private cleanString;
|
|
25
|
+
private migrate;
|
|
26
|
+
}
|