testeranto 0.140.2 → 0.146.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/.aider.chat.history.md +11006 -0
- package/.aider.input.history +441 -0
- package/.aider.tags.cache.v3/06/1a/1ec9fd1f595d4b36094caef45894.val +0 -0
- package/.aider.tags.cache.v3/0f/f6/f42b5108253d75de3cb6286df7f6.val +0 -0
- package/.aider.tags.cache.v3/{ad/3c/10f2ab1397f6d544e613d2a6acaf.val → 3d/81/8b6f0e9b98ec2952cdb8968ac386.val} +0 -0
- package/.aider.tags.cache.v3/cache.db +0 -0
- package/.aider.tags.cache.v3/{a7/97/6d37fce350ad2d588f36729db0cd.val → d6/7d/1820c2d4b9330eab7017da4515e7.val} +0 -0
- package/README.md +15 -16
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docs/aiderTest.sh +1 -0
- package/docs/index.md +45 -33
- package/docs/testing.ai.txt +98 -0
- package/docs/testing.prompt.txt +8 -0
- package/package.json +3 -3
- package/src/Node.ts +17 -13
- package/src/PM/PM_WithEslintAndTsc.ts +83 -67
- package/src/PM/main.ts +182 -92
- package/src/PM/node.ts +1 -15
- package/src/PM/nodeSidecar.ts +0 -1
- package/src/Pure.test.ts +299 -0
- package/src/Pure.ts +20 -2
- package/src/Types.ts +5 -5
- package/src/Web.ts +1 -1
- package/src/build.ts +0 -1
- package/src/esbuildConfigs/consoleDetectorPlugin.ts +28 -14
- package/src/esbuildConfigs/nativeImportDetectorPlugin.ts +26 -0
- package/src/esbuildConfigs/pure.ts +3 -1
- package/src/esbuildConfigs/rebuildPlugin.ts +1 -4
- package/src/lib/BaseSuite.test/node.test.ts +12 -0
- package/src/lib/BaseSuite.test/pure.test.ts +12 -0
- package/src/lib/{BaseSuite.test.ts → BaseSuite.test/test.ts} +36 -27
- package/src/lib/BaseSuite.test/web.test.ts +12 -0
- package/src/lib/BaseSuite.ts +17 -15
- package/src/lib/abstractBase.test/MockGiven.ts +31 -0
- package/src/lib/abstractBase.test/MockThen.ts +20 -0
- package/src/lib/abstractBase.test/MockWhen.ts +17 -0
- package/src/lib/abstractBase.test/implementation.ts +51 -0
- package/src/lib/abstractBase.test/index.ts +19 -0
- package/src/lib/abstractBase.test/interface.ts +12 -0
- package/src/lib/abstractBase.test/specification.ts +49 -0
- package/src/lib/abstractBase.test/types.ts +19 -0
- package/src/lib/abstractBase.ts +0 -2
- package/src/lib/baseBuilder.test/TestBaseBuilder.ts +83 -0
- package/src/lib/baseBuilder.test/baseBuilder.test.implementation.ts +134 -0
- package/src/lib/baseBuilder.test/baseBuilder.test.interface.ts +18 -0
- package/src/lib/baseBuilder.test/baseBuilder.test.node.ts +14 -0
- package/src/lib/baseBuilder.test/baseBuilder.test.pure.ts +14 -0
- package/src/lib/baseBuilder.test/baseBuilder.test.specification.ts +35 -0
- package/src/lib/baseBuilder.test/baseBuilder.test.types.ts +36 -0
- package/src/lib/baseBuilder.test/baseBuilder.test.web.ts +14 -0
- package/src/lib/basebuilder.ts +2 -1
- package/src/lib/classBuilder.test/TestClassBuilder.ts +88 -0
- package/src/lib/classBuilder.test/classBuilder.test.implementation.ts +204 -0
- package/src/lib/classBuilder.test/classBuilder.test.interface.ts +18 -0
- package/src/lib/classBuilder.test/classBuilder.test.specification.ts +113 -0
- package/src/lib/classBuilder.test/classBuilder.test.ts +14 -0
- package/src/lib/classBuilder.test/classBuilder.test.types.ts +84 -0
- package/src/lib/core.test/MockCore.ts +49 -0
- package/src/lib/core.test/core.test.implementation.ts +129 -0
- package/src/lib/core.test/core.test.interface.ts +18 -0
- package/src/lib/core.test/core.test.specification.ts +99 -0
- package/src/lib/core.test/core.test.ts +15 -0
- package/src/lib/core.test/core.test.types.ts +68 -0
- package/src/lib/core.ts +1 -11
- package/src/lib/pmProxy.test/implementation.ts +104 -0
- package/src/lib/pmProxy.test/index.ts +19 -0
- package/src/lib/pmProxy.test/interface.ts +46 -0
- package/src/lib/pmProxy.test/mockPM.ts +38 -0
- package/src/lib/pmProxy.test/mockPMBase.ts +136 -0
- package/src/lib/pmProxy.test/specification.ts +123 -0
- package/src/lib/pmProxy.test/types.ts +45 -0
- package/src/lib/pmProxy.ts +40 -193
- package/src/run.ts +7 -7
- package/testeranto/bundles/node/allTests/chunk-NQBTLMSG.mjs +254 -0
- package/testeranto/bundles/node/allTests/chunk-RF3LIUSG.mjs +765 -0
- package/testeranto/bundles/node/allTests/chunk-YZWFKYY3.mjs +171 -0
- package/testeranto/bundles/node/allTests/metafile.json +628 -3567
- package/testeranto/bundles/node/allTests/src/lib/BaseSuite.test/node.test.mjs +325 -0
- package/testeranto/bundles/node/allTests/src/lib/baseBuilder.test/baseBuilder.test.node.mjs +226 -0
- package/testeranto/bundles/node/allTests/src/lib/classBuilder.test/classBuilder.test.mjs +408 -0
- package/testeranto/bundles/node/allTests/src/lib/core.test/core.test.mjs +279 -0
- package/testeranto/bundles/node/allTests/src/lib/pmProxy.test/index.mjs +4587 -0
- package/testeranto/bundles/{node/allTests/chunk-4PJCC2XT.mjs → pure/allTests/chunk-W22WOQNK.mjs} +208 -326
- package/testeranto/bundles/pure/allTests/metafile.json +732 -3
- package/testeranto/bundles/pure/allTests/src/Pure.test.mjs +369 -0
- package/testeranto/bundles/{node/allTests/src/lib/BaseSuite.test.mjs → pure/allTests/src/lib/BaseSuite.test/pure.test.mjs} +26 -8
- package/testeranto/bundles/pure/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure.mjs +224 -0
- package/testeranto/bundles/web/allTests/chunk-FIZ3WLUB.mjs +943 -0
- package/testeranto/bundles/web/allTests/metafile.json +1133 -2
- package/testeranto/bundles/web/allTests/src/lib/BaseSuite.test/web.test.html +19 -0
- package/testeranto/bundles/web/allTests/src/lib/BaseSuite.test/web.test.mjs +322 -0
- package/testeranto/bundles/web/allTests/src/lib/baseBuilder.test/baseBuilder.test.web.html +19 -0
- package/testeranto/bundles/web/allTests/src/lib/baseBuilder.test/baseBuilder.test.web.mjs +10964 -0
- package/testeranto/index.html +1 -1
- package/testeranto/reports/allTests/config.json +50 -11
- package/testeranto/reports/allTests/index.html +1 -1
- package/testeranto/reports/allTests/src/Pure.test/pure/lint_errors.json +1539 -0
- package/testeranto/reports/allTests/src/Pure.test/pure/logs.txt +11 -0
- package/testeranto/reports/allTests/src/Pure.test/pure/message +1 -0
- package/testeranto/reports/allTests/src/Pure.test/pure/prompt.txt +8 -0
- package/testeranto/reports/allTests/src/{PM/__tests__/pureSidecar.testeranto/node → Pure.test/pure}/type_errors.txt +18 -14
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/lint_errors.json +620 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/logs.txt +12 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/message +1 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/prompt.txt +8 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/type_errors.txt +94 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/index.html +21 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/lint_errors.json +620 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/logs.txt +11 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/message +1 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/prompt.txt +8 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/type_errors.txt +104 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/dev.html +21 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/index.html +21 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/{node → web.test/web}/lint_errors.json +69 -57
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/logs.txt +10 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/message +1 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/prompt.txt +8 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/type_errors.txt +95 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/dev.html +21 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/index.html +21 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/lint_errors.json +966 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/message +1 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/prompt.txt +11 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/type_errors.txt +57 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/bdd_errors.txt +1 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/dev.html +21 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/index.html +21 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/lint_errors.json +966 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/log.txt +0 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/message +1 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/prompt.txt +11 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/tests.json +57 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/type_errors.txt +57 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/bdd_errors.txt +1 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/dev.html +21 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/index.html +21 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/lint_errors.json +966 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/log.txt +0 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/logs.txt +0 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/message +1 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/prompt.txt +11 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/tests.json +57 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/type_errors.txt +48 -0
- package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/dev.html +21 -0
- package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/index.html +21 -0
- package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/lint_errors.json +791 -0
- package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/logs.txt +12 -0
- package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/message +1 -0
- package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/prompt.txt +11 -0
- package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/type_errors.txt +55 -0
- package/testeranto/reports/allTests/src/lib/core.test/core.test/node/dev.html +21 -0
- package/testeranto/reports/allTests/src/lib/core.test/core.test/node/index.html +21 -0
- package/testeranto/reports/allTests/src/lib/core.test/core.test/node/lint_errors.json +416 -0
- package/testeranto/reports/allTests/src/lib/core.test/core.test/node/logs.txt +17 -0
- package/testeranto/reports/allTests/src/lib/core.test/core.test/node/message +1 -0
- package/testeranto/reports/allTests/src/lib/core.test/core.test/node/prompt.txt +11 -0
- package/testeranto/reports/allTests/src/lib/core.test/core.test/node/type_errors.txt +65 -0
- package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/dev.html +21 -0
- package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/index.html +21 -0
- package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/lint_errors.json +1724 -0
- package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/log.txt +0 -0
- package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/logs.txt +30 -0
- package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/message +1 -0
- package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/prompt.txt +11 -0
- package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/type_errors.txt +64 -0
- package/testeranto/reports/allTests/summary.json +59 -24
- package/testeranto.config.ts +37 -12
- package/tsc.log +273 -27
- package/testeranto/bundles/node/allTests/chunk-PG6KUKNP.mjs +0 -44
- package/testeranto/bundles/node/allTests/src/PM/__tests__/nodeSidecar.testeranto.mjs +0 -187
- package/testeranto/bundles/node/allTests/src/PM/__tests__/pureSidecar.testeranto.mjs +0 -156
- package/testeranto/bundles/node/allTests/src/PM/__tests__/webSidecar.testeranto.mjs +0 -156
- package/testeranto/bundles/node/allTests/src/mothership/test.mjs +0 -24411
- package/testeranto/reports/allTests/src/PM/__tests__/nodeSidecar.testeranto/node/index.html +0 -21
- package/testeranto/reports/allTests/src/PM/__tests__/nodeSidecar.testeranto/node/lint_errors.json +0 -80
- package/testeranto/reports/allTests/src/PM/__tests__/nodeSidecar.testeranto/node/message +0 -1
- package/testeranto/reports/allTests/src/PM/__tests__/nodeSidecar.testeranto/node/prompt.txt +0 -8
- package/testeranto/reports/allTests/src/PM/__tests__/nodeSidecar.testeranto/node/type_errors.txt +0 -28
- package/testeranto/reports/allTests/src/PM/__tests__/pureSidecar.testeranto/node/index.html +0 -21
- package/testeranto/reports/allTests/src/PM/__tests__/pureSidecar.testeranto/node/lint_errors.json +0 -80
- package/testeranto/reports/allTests/src/PM/__tests__/pureSidecar.testeranto/node/message +0 -1
- package/testeranto/reports/allTests/src/PM/__tests__/pureSidecar.testeranto/node/prompt.txt +0 -8
- package/testeranto/reports/allTests/src/PM/__tests__/webSidecar.testeranto/node/index.html +0 -21
- package/testeranto/reports/allTests/src/PM/__tests__/webSidecar.testeranto/node/lint_errors.json +0 -80
- package/testeranto/reports/allTests/src/PM/__tests__/webSidecar.testeranto/node/message +0 -1
- package/testeranto/reports/allTests/src/PM/__tests__/webSidecar.testeranto/node/prompt.txt +0 -8
- package/testeranto/reports/allTests/src/PM/__tests__/webSidecar.testeranto/node/type_errors.txt +0 -32
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node/console_log.txt +0 -35
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node/index.html +0 -21
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node/message +0 -1
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node/prompt.txt +0 -7
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node/type_errors.txt +0 -68
- package/testeranto/reports/allTests/src/mothership/test/node/index.html +0 -21
- package/testeranto/reports/allTests/src/mothership/test/node/lint_errors.json +0 -1
- package/testeranto/reports/allTests/src/mothership/test/node/message +0 -1
- package/testeranto/reports/allTests/src/mothership/test/node/prompt.txt +0 -8
- package/testeranto/reports/allTests/src/mothership/test/node/type_errors.txt +0 -24
- /package/testeranto/reports/allTests/src/{PM/__tests__/nodeSidecar.testeranto/node → Pure.test/pure}/dev.html +0 -0
- /package/testeranto/reports/allTests/src/{PM/__tests__/pureSidecar.testeranto/node/dev.html → Pure.test/pure/index.html} +0 -0
- /package/testeranto/reports/allTests/src/{PM/__tests__/webSidecar.testeranto → lib/BaseSuite.test/node.test}/node/dev.html +0 -0
- /package/testeranto/reports/allTests/src/lib/BaseSuite.test/{node/dev.html → node.test/node/index.html} +0 -0
- /package/testeranto/reports/allTests/src/{mothership/test/node → lib/BaseSuite.test/pure.test/pure}/dev.html +0 -0
- /package/testeranto/reports/allTests/src/lib/{BaseSuite.test/node/log.txt → baseBuilder.test/baseBuilder.test.node/node/logs.txt} +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ITestInterface } from "../../CoreTypes";
|
|
2
|
+
import { I } from "./core.test.types";
|
|
3
|
+
|
|
4
|
+
export const testInterface: ITestInterface<I> = {
|
|
5
|
+
beforeEach: async (subject, initializer, testResource, initialValues, pm) => {
|
|
6
|
+
return initializer();
|
|
7
|
+
},
|
|
8
|
+
andWhen: async (store, whenCB, testResource, pm) => {
|
|
9
|
+
return whenCB(store, pm);
|
|
10
|
+
},
|
|
11
|
+
butThen: async (store, thenCB, testResource, pm) => {
|
|
12
|
+
return thenCB(store, pm);
|
|
13
|
+
},
|
|
14
|
+
afterEach: (store) => store,
|
|
15
|
+
afterAll: (store, pm) => {},
|
|
16
|
+
assertThis: (result) => !!result,
|
|
17
|
+
beforeAll: async (input, testResource, pm) => input as any
|
|
18
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { ITestSpecification } from "../../CoreTypes";
|
|
2
|
+
import { I, O } from "./core.test.types";
|
|
3
|
+
|
|
4
|
+
export const specification: ITestSpecification<I, O> = (
|
|
5
|
+
Suite,
|
|
6
|
+
Given,
|
|
7
|
+
When,
|
|
8
|
+
Then,
|
|
9
|
+
Check
|
|
10
|
+
) => {
|
|
11
|
+
return [
|
|
12
|
+
Suite.Default(
|
|
13
|
+
"Testeranto Core Functionality",
|
|
14
|
+
{
|
|
15
|
+
// Initialization tests
|
|
16
|
+
defaultInitialization: Given.Default(
|
|
17
|
+
["Should initialize with default values"],
|
|
18
|
+
[],
|
|
19
|
+
[Then.initializedProperly()]
|
|
20
|
+
),
|
|
21
|
+
customInputInitialization: Given.WithCustomInput(
|
|
22
|
+
{ test: "input" },
|
|
23
|
+
[],
|
|
24
|
+
[Then.initializedProperly()]
|
|
25
|
+
),
|
|
26
|
+
|
|
27
|
+
// Configuration tests
|
|
28
|
+
resourceConfig: Given.WithResourceRequirements(
|
|
29
|
+
{ ports: [3000, 3001] },
|
|
30
|
+
[],
|
|
31
|
+
[Then.resourceRequirementsSet()]
|
|
32
|
+
),
|
|
33
|
+
interfaceConfig: Given.WithCustomInterface(
|
|
34
|
+
{
|
|
35
|
+
assertThis: (x) => !!x,
|
|
36
|
+
beforeEach: async (s, i) => i()
|
|
37
|
+
},
|
|
38
|
+
[],
|
|
39
|
+
[Then.interfaceConfigured()]
|
|
40
|
+
),
|
|
41
|
+
|
|
42
|
+
// Core operations
|
|
43
|
+
specGeneration: Given.Default(
|
|
44
|
+
["Should generate test specs"],
|
|
45
|
+
[],
|
|
46
|
+
[Then.specsGenerated()]
|
|
47
|
+
),
|
|
48
|
+
jobCreation: Given.Default(
|
|
49
|
+
["Should create test jobs"],
|
|
50
|
+
[],
|
|
51
|
+
[Then.jobsCreated()]
|
|
52
|
+
),
|
|
53
|
+
artifactHandling: Given.Default(
|
|
54
|
+
["Should track artifacts"],
|
|
55
|
+
[When.addArtifact(Promise.resolve("test"))],
|
|
56
|
+
[Then.artifactsTracked()]
|
|
57
|
+
)
|
|
58
|
+
},
|
|
59
|
+
[]
|
|
60
|
+
),
|
|
61
|
+
|
|
62
|
+
Suite.ExtendedSuite(
|
|
63
|
+
"Testeranto Advanced Features",
|
|
64
|
+
{
|
|
65
|
+
// Error handling
|
|
66
|
+
errorPropagation: Given.Default(
|
|
67
|
+
["Should propagate errors properly"],
|
|
68
|
+
[When.triggerError("test error")],
|
|
69
|
+
[Then.errorThrown("test error")]
|
|
70
|
+
),
|
|
71
|
+
|
|
72
|
+
// Dynamic behavior
|
|
73
|
+
specModification: Given.Default(
|
|
74
|
+
["Should allow spec modification"],
|
|
75
|
+
[When.modifySpecs((specs) => [...specs, {name: "extra"}])],
|
|
76
|
+
[Then.specsModified(1)]
|
|
77
|
+
),
|
|
78
|
+
|
|
79
|
+
// Full lifecycle
|
|
80
|
+
testExecution: Given.Default(
|
|
81
|
+
["Should execute full test lifecycle"],
|
|
82
|
+
[],
|
|
83
|
+
[Then.testRunSuccessful()]
|
|
84
|
+
),
|
|
85
|
+
|
|
86
|
+
// Custom implementations
|
|
87
|
+
customImpl: Given.WithCustomImplementation(
|
|
88
|
+
{
|
|
89
|
+
...implementation,
|
|
90
|
+
suites: {Default: "Custom suite"}
|
|
91
|
+
},
|
|
92
|
+
[],
|
|
93
|
+
[Then.specsGenerated()]
|
|
94
|
+
)
|
|
95
|
+
},
|
|
96
|
+
[]
|
|
97
|
+
)
|
|
98
|
+
];
|
|
99
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Testeranto from "../../Pure";
|
|
2
|
+
import { specification } from "./core.test.specification";
|
|
3
|
+
import { implementation } from "./core.test.implementation";
|
|
4
|
+
import { testInterface } from "./core.test.interface";
|
|
5
|
+
import { I, O, M } from "./core.test.types";
|
|
6
|
+
import { MockCore } from "./MockCore";
|
|
7
|
+
|
|
8
|
+
export default Testeranto<I, O, M>(
|
|
9
|
+
MockCore.prototype, // test subject
|
|
10
|
+
specification, // test scenarios
|
|
11
|
+
implementation, // test operations
|
|
12
|
+
testInterface, // test lifecycle hooks
|
|
13
|
+
{ ports: [] }, // resource requirements
|
|
14
|
+
(cb) => cb() // error handler
|
|
15
|
+
);
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Ibdd_in, Ibdd_out, ITestInterface } from "../../CoreTypes";
|
|
2
|
+
import { MockCore } from "./MockCore";
|
|
3
|
+
import { ITTestResourceRequest } from "..";
|
|
4
|
+
|
|
5
|
+
export type I = Ibdd_in<
|
|
6
|
+
{}, // iinput
|
|
7
|
+
MockCore<any, any, any>, // isubject
|
|
8
|
+
MockCore<any, any, any>, // istore
|
|
9
|
+
MockCore<any, any, any>, // iselection
|
|
10
|
+
() => MockCore<any, any, any>, // given
|
|
11
|
+
(store: any) => any, // when
|
|
12
|
+
(store: any) => any // then
|
|
13
|
+
>;
|
|
14
|
+
|
|
15
|
+
export type O = Ibdd_out<
|
|
16
|
+
// Suites
|
|
17
|
+
{
|
|
18
|
+
Default: [string];
|
|
19
|
+
ExtendedSuite: [description: string];
|
|
20
|
+
},
|
|
21
|
+
// Givens
|
|
22
|
+
{
|
|
23
|
+
Default: [];
|
|
24
|
+
WithCustomInput: [input: any];
|
|
25
|
+
WithResourceRequirements: [requirements: ITTestResourceRequest];
|
|
26
|
+
WithCustomInterface: [interface: Partial<ITestInterface<any>>];
|
|
27
|
+
},
|
|
28
|
+
// Whens
|
|
29
|
+
{
|
|
30
|
+
addArtifact: [artifact: Promise<any>];
|
|
31
|
+
setTestJobs: [jobs: any[]];
|
|
32
|
+
modifySpecs: [modifier: (specs: any[]) => any[]];
|
|
33
|
+
triggerError: [message: string];
|
|
34
|
+
},
|
|
35
|
+
// Thens
|
|
36
|
+
{
|
|
37
|
+
initializedProperly: [];
|
|
38
|
+
specsGenerated: [];
|
|
39
|
+
jobsCreated: [];
|
|
40
|
+
artifactsTracked: [];
|
|
41
|
+
resourceRequirementsSet: [];
|
|
42
|
+
interfaceConfigured: [];
|
|
43
|
+
errorThrown: [expectedMessage: string];
|
|
44
|
+
testRunSuccessful: [];
|
|
45
|
+
},
|
|
46
|
+
// Checks
|
|
47
|
+
{
|
|
48
|
+
Default: [];
|
|
49
|
+
}
|
|
50
|
+
>;
|
|
51
|
+
|
|
52
|
+
export type M = {
|
|
53
|
+
givens: {
|
|
54
|
+
[K in keyof O["givens"]]: (
|
|
55
|
+
...args: O["givens"][K]
|
|
56
|
+
) => MockCore<any, any, any>;
|
|
57
|
+
};
|
|
58
|
+
whens: {
|
|
59
|
+
[K in keyof O["whens"]]: (
|
|
60
|
+
...args: O["whens"][K]
|
|
61
|
+
) => (builder: MockCore<any, any, any>) => MockCore<any, any, any>;
|
|
62
|
+
};
|
|
63
|
+
thens: {
|
|
64
|
+
[K in keyof O["thens"]]: (
|
|
65
|
+
...args: O["thens"][K]
|
|
66
|
+
) => (builder: MockCore<any, any, any>) => MockCore<any, any, any>;
|
|
67
|
+
};
|
|
68
|
+
};
|
package/src/lib/core.ts
CHANGED
|
@@ -21,7 +21,7 @@ import type {
|
|
|
21
21
|
} from "../CoreTypes";
|
|
22
22
|
import { BaseSuite } from "./BaseSuite.js";
|
|
23
23
|
|
|
24
|
-
export default abstract class
|
|
24
|
+
export default abstract class TesterantoCore<
|
|
25
25
|
I extends Ibdd_in_any,
|
|
26
26
|
O extends Ibdd_out_any,
|
|
27
27
|
M
|
|
@@ -120,16 +120,6 @@ export default abstract class Testeranto<
|
|
|
120
120
|
testResource,
|
|
121
121
|
pm
|
|
122
122
|
);
|
|
123
|
-
// try {
|
|
124
|
-
// return await fullTestInterface.andWhen(
|
|
125
|
-
// store,
|
|
126
|
-
// whenCB,
|
|
127
|
-
// testResource,
|
|
128
|
-
// pm
|
|
129
|
-
// );
|
|
130
|
-
// } catch (e) {
|
|
131
|
-
// console.log("mark22", e);
|
|
132
|
-
// }
|
|
133
123
|
}
|
|
134
124
|
} as any,
|
|
135
125
|
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { I, M, O } from "./types";
|
|
2
|
+
import { ITestImplementation } from "../../CoreTypes";
|
|
3
|
+
// import { ITestProxies } from ".";
|
|
4
|
+
import { IPM } from "../types";
|
|
5
|
+
import { IProxiedFunctions, IProxy } from "../pmProxy";
|
|
6
|
+
import { MockPMBase } from "./mockPMBase";
|
|
7
|
+
|
|
8
|
+
export const implementation: ITestImplementation<I, O, M> = {
|
|
9
|
+
suites: {
|
|
10
|
+
Default: "PM Proxy Tests",
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
givens: {
|
|
14
|
+
SomeBaseString: (s: string) => s,
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
whens: {
|
|
18
|
+
// functions have no mutations
|
|
19
|
+
},
|
|
20
|
+
thens: {
|
|
21
|
+
theButTheProxyReturns:
|
|
22
|
+
(method: IProxiedFunctions, expectedPath: string) =>
|
|
23
|
+
(store: { butThenProxy: IProxy }) => {
|
|
24
|
+
const mockPm = new MockPMBase() as unknown as IPM;
|
|
25
|
+
const filepath = "test/path";
|
|
26
|
+
const proxiedPm = store.butThenProxy(mockPm, filepath);
|
|
27
|
+
|
|
28
|
+
let actualPath: string;
|
|
29
|
+
let actualContent: any;
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
switch (method) {
|
|
33
|
+
case "writeFileSync":
|
|
34
|
+
const content = expectedPath.includes('content') ?
|
|
35
|
+
"test content" : "default content";
|
|
36
|
+
proxiedPm.writeFileSync(
|
|
37
|
+
expectedPath.includes('empty') ? "" :
|
|
38
|
+
expectedPath.includes('nested') ? "nested/folder/test.txt" :
|
|
39
|
+
expectedPath.includes('spaces') ? "file with spaces.txt" :
|
|
40
|
+
expectedPath.includes('invalid') ? "../invalid.txt" :
|
|
41
|
+
"test.txt",
|
|
42
|
+
content
|
|
43
|
+
);
|
|
44
|
+
actualPath = mockPm.getLastCall("writeFileSync")?.path;
|
|
45
|
+
actualContent = mockPm.getLastCall("writeFileSync")?.content;
|
|
46
|
+
break;
|
|
47
|
+
|
|
48
|
+
case "createWriteStream":
|
|
49
|
+
proxiedPm.createWriteStream(
|
|
50
|
+
expectedPath.includes('empty') ? "" : "stream.txt"
|
|
51
|
+
);
|
|
52
|
+
actualPath = mockPm.getLastCall("createWriteStream")?.path;
|
|
53
|
+
break;
|
|
54
|
+
|
|
55
|
+
case "screencast":
|
|
56
|
+
proxiedPm.screencast(
|
|
57
|
+
{
|
|
58
|
+
path: "screen.png",
|
|
59
|
+
quality: 80,
|
|
60
|
+
fullPage: true
|
|
61
|
+
},
|
|
62
|
+
"test"
|
|
63
|
+
);
|
|
64
|
+
actualPath = mockPm.getLastCall("screencast")?.opts?.path;
|
|
65
|
+
actualContent = mockPm.getLastCall("screencast")?.opts;
|
|
66
|
+
break;
|
|
67
|
+
|
|
68
|
+
case "customScreenShot":
|
|
69
|
+
proxiedPm.customScreenShot(
|
|
70
|
+
{ path: "shot.png" },
|
|
71
|
+
"test"
|
|
72
|
+
);
|
|
73
|
+
actualPath = mockPm.getLastCall("customScreenShot")?.opts?.path;
|
|
74
|
+
break;
|
|
75
|
+
|
|
76
|
+
default:
|
|
77
|
+
throw new Error(`Unknown method: ${method}`);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (expectedPath === undefined) {
|
|
81
|
+
return [undefined, undefined];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return [actualPath, expectedPath, actualContent];
|
|
85
|
+
} catch (error) {
|
|
86
|
+
return [error.message, expectedPath];
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
verifyContent: (expectedContent: any) => (result: any[]) => {
|
|
91
|
+
const actualContent = result[2];
|
|
92
|
+
if (JSON.stringify(actualContent) !== JSON.stringify(expectedContent)) {
|
|
93
|
+
throw new Error(
|
|
94
|
+
`Content mismatch. Expected: ${JSON.stringify(expectedContent)}, Got: ${JSON.stringify(actualContent)}`
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
return result;
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
checks: {
|
|
102
|
+
Default: (s: string) => s,
|
|
103
|
+
},
|
|
104
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Testeranto from "../../Node";
|
|
2
|
+
import { implementation } from "./implementation";
|
|
3
|
+
import { specification } from "./specification";
|
|
4
|
+
import { testInterface } from "./interface";
|
|
5
|
+
import { I, O } from "./types";
|
|
6
|
+
|
|
7
|
+
import { butThenProxy, IProxy } from "../pmProxy";
|
|
8
|
+
|
|
9
|
+
export type ITestProxies = { butThenProxy: IProxy };
|
|
10
|
+
|
|
11
|
+
export default Testeranto<I, O, {}>(
|
|
12
|
+
// because of the nature of testeranto, we must add all the testable items here
|
|
13
|
+
{
|
|
14
|
+
butThenProxy,
|
|
15
|
+
},
|
|
16
|
+
specification,
|
|
17
|
+
implementation,
|
|
18
|
+
testInterface
|
|
19
|
+
);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { assert } from "chai";
|
|
2
|
+
|
|
3
|
+
import { I } from "./types";
|
|
4
|
+
import { ITestInterface } from "../../CoreTypes";
|
|
5
|
+
import { andWhenProxy, butThenProxy } from "../pmProxy";
|
|
6
|
+
import { IPM } from "../types";
|
|
7
|
+
import { MockPMBase } from "./mockPMBase";
|
|
8
|
+
// import { butThenProxy, andWhenProxy, beforeEachProxy } from "../pmProxy";
|
|
9
|
+
|
|
10
|
+
export const testInterface: ITestInterface<I> = {
|
|
11
|
+
beforeEach: async (subject, initializer, testResource, initialValues, pm) => {
|
|
12
|
+
return subject;
|
|
13
|
+
// const mockPM = MockPMBase();
|
|
14
|
+
// return {
|
|
15
|
+
// beforeEachProxy: subject.butThenProxy(
|
|
16
|
+
// new MockPMBase() as unknown as IPM,
|
|
17
|
+
// initializer
|
|
18
|
+
// ),
|
|
19
|
+
// };
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
andWhen: async (store, whenCB, testResource, pm) => {
|
|
23
|
+
const proxiedPM = andWhenProxy(pm, "some/path");
|
|
24
|
+
return whenCB(store, proxiedPM);
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
butThen: async (store, thenCB, testResource, pm) => {
|
|
28
|
+
const proxiedPM = butThenProxy(pm, "some/path");
|
|
29
|
+
return thenCB(store, proxiedPM);
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
afterEach: async (store, key, pm) => store,
|
|
33
|
+
afterAll: async (store, pm) => {},
|
|
34
|
+
beforeAll: async (input, testResource, pm, theGivenString) => {
|
|
35
|
+
return {
|
|
36
|
+
beforeEachProxy: input.butThenProxy(
|
|
37
|
+
new MockPMBase() as unknown as IPM,
|
|
38
|
+
theGivenString
|
|
39
|
+
),
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
assertThis: (returnedFilePath, expectation) => {
|
|
44
|
+
assert.equal(returnedFilePath, expectation);
|
|
45
|
+
},
|
|
46
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { MockPMBase } from "./mockPMBase";
|
|
2
|
+
|
|
3
|
+
export class MockPM extends MockPMBase {
|
|
4
|
+
server: any;
|
|
5
|
+
|
|
6
|
+
constructor(configs?: any) {
|
|
7
|
+
super(configs);
|
|
8
|
+
this.server = {};
|
|
9
|
+
this.testResourceConfiguration = {};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// PM-specific methods
|
|
13
|
+
start(): Promise<void> {
|
|
14
|
+
this.trackCall("start", {});
|
|
15
|
+
return Promise.resolve();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
stop(): Promise<void> {
|
|
19
|
+
this.trackCall("stop", {});
|
|
20
|
+
return Promise.resolve();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
launchSideCar(n: number): Promise<[number, any]> {
|
|
24
|
+
this.trackCall("launchSideCar", { n });
|
|
25
|
+
return Promise.resolve([n, this.testResourceConfiguration]);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
stopSideCar(n: number): Promise<any> {
|
|
29
|
+
this.trackCall("stopSideCar", { n });
|
|
30
|
+
return Promise.resolve();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Override any methods that need different behavior from MockPMBase
|
|
34
|
+
// For example:
|
|
35
|
+
writeFileSync(path: string, content: string): Promise<boolean> {
|
|
36
|
+
return super.writeFileSync(path, content, "default-test-name");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { Browser } from "puppeteer-core";
|
|
2
|
+
|
|
3
|
+
import { IBuiltConfig, ITLog } from "../index";
|
|
4
|
+
import { PM_Base } from "../../PM/base";
|
|
5
|
+
|
|
6
|
+
export class MockPMBase implements PM_Base {
|
|
7
|
+
browser: Browser;
|
|
8
|
+
configs: IBuiltConfig;
|
|
9
|
+
calls: Record<string, any[]> = {};
|
|
10
|
+
testResourceConfiguration: any = {};
|
|
11
|
+
|
|
12
|
+
constructor(configs?: IBuiltConfig) {
|
|
13
|
+
this.configs = configs || ({} as IBuiltConfig);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Common tracking functionality
|
|
17
|
+
protected trackCall(method: string, args: any) {
|
|
18
|
+
if (!this.calls[method]) {
|
|
19
|
+
this.calls[method] = [];
|
|
20
|
+
}
|
|
21
|
+
this.calls[method].push(args);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
getCallCount(method: string): number {
|
|
25
|
+
return this.calls[method]?.length || 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
getLastCall(method: string): any {
|
|
29
|
+
const calls = this.calls[method];
|
|
30
|
+
return calls ? calls[calls.length - 1] : null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Minimal implementations of required methods
|
|
34
|
+
launchSideCar(n: number, testName: string, projectName: string) {
|
|
35
|
+
this.trackCall("launchSideCar", { n, testName, projectName });
|
|
36
|
+
return Promise.resolve();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
end(uid: number): Promise<boolean> {
|
|
40
|
+
this.trackCall("end", { uid });
|
|
41
|
+
return Promise.resolve(true);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
writeFileSync(
|
|
45
|
+
path: string,
|
|
46
|
+
content: string,
|
|
47
|
+
testName?: string
|
|
48
|
+
): Promise<boolean> {
|
|
49
|
+
this.trackCall("writeFileSync", { path, content, testName });
|
|
50
|
+
return Promise.resolve(true);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
createWriteStream(path: string, testName?: string): Promise<number> {
|
|
54
|
+
this.trackCall("createWriteStream", { path, testName });
|
|
55
|
+
return Promise.resolve(0);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
screencast(opts: any, testName: string, page?: any): Promise<any> {
|
|
59
|
+
this.trackCall("screencast", { opts, testName, page });
|
|
60
|
+
return Promise.resolve({});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
customScreenShot(opts: any, testName: string, pageUid?: any): Promise<any> {
|
|
64
|
+
this.trackCall("customScreenShot", { opts, testName, pageUid });
|
|
65
|
+
return Promise.resolve({});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
testArtiFactoryfileWriter(
|
|
69
|
+
tLog: ITLog,
|
|
70
|
+
callback: (Promise: any) => void
|
|
71
|
+
): any {
|
|
72
|
+
return (fPath: string, value: string | Buffer | any) => {
|
|
73
|
+
this.trackCall("testArtiFactoryfileWriter", { fPath, value });
|
|
74
|
+
callback(Promise.resolve());
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Other required PM_Base methods with minimal implementations
|
|
79
|
+
closePage(p: any): any {
|
|
80
|
+
return Promise.resolve();
|
|
81
|
+
}
|
|
82
|
+
$(selector: string, p: string): Promise<any> {
|
|
83
|
+
return Promise.resolve();
|
|
84
|
+
}
|
|
85
|
+
click(selector: string, page: any): any {
|
|
86
|
+
return Promise.resolve();
|
|
87
|
+
}
|
|
88
|
+
goto(p: string, url: string): any {
|
|
89
|
+
return Promise.resolve();
|
|
90
|
+
}
|
|
91
|
+
newPage(): Promise<string> {
|
|
92
|
+
return Promise.resolve("mock-page");
|
|
93
|
+
}
|
|
94
|
+
pages(): Promise<string[]> {
|
|
95
|
+
return Promise.resolve(["mock-page"]);
|
|
96
|
+
}
|
|
97
|
+
waitForSelector(p: string, s: string): any {
|
|
98
|
+
return Promise.resolve(true);
|
|
99
|
+
}
|
|
100
|
+
focusOn(selector: string, p: string): any {
|
|
101
|
+
return Promise.resolve();
|
|
102
|
+
}
|
|
103
|
+
typeInto(value: string, p: string): any {
|
|
104
|
+
return Promise.resolve();
|
|
105
|
+
}
|
|
106
|
+
getAttribute(selector: string, attribute: string, p: string): any {
|
|
107
|
+
return Promise.resolve();
|
|
108
|
+
}
|
|
109
|
+
getInnerHtml(selector: string, p: string): Promise<any> {
|
|
110
|
+
return Promise.resolve();
|
|
111
|
+
}
|
|
112
|
+
isDisabled(selector: string, p: string): any {
|
|
113
|
+
return Promise.resolve(false);
|
|
114
|
+
}
|
|
115
|
+
screencastStop(s: string): any {
|
|
116
|
+
return Promise.resolve();
|
|
117
|
+
}
|
|
118
|
+
existsSync(destFolder: string): boolean {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
mkdirSync(fp: string): any {
|
|
122
|
+
return Promise.resolve();
|
|
123
|
+
}
|
|
124
|
+
write(uid: number, contents: string): Promise<boolean> {
|
|
125
|
+
return Promise.resolve(true);
|
|
126
|
+
}
|
|
127
|
+
page(p: any): string | undefined {
|
|
128
|
+
return "mock-page";
|
|
129
|
+
}
|
|
130
|
+
doInPage(p: string, cb: (p: any) => unknown): any {
|
|
131
|
+
return Promise.resolve();
|
|
132
|
+
}
|
|
133
|
+
customclose(): any {
|
|
134
|
+
return Promise.resolve();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { I, O } from "./types";
|
|
2
|
+
import { ITestSpecification } from "../../CoreTypes";
|
|
3
|
+
|
|
4
|
+
export const specification: ITestSpecification<I, O> = (
|
|
5
|
+
Suite,
|
|
6
|
+
Given,
|
|
7
|
+
When,
|
|
8
|
+
Then,
|
|
9
|
+
Check
|
|
10
|
+
) => [
|
|
11
|
+
Suite.Default("PM Proxy Functionality", {
|
|
12
|
+
// Basic path rewriting tests
|
|
13
|
+
writeFileProxyTest: Given.SomeBaseString(
|
|
14
|
+
["butThenProxy should rewrite writeFileSync paths"],
|
|
15
|
+
[],
|
|
16
|
+
[Then.theButTheProxyReturns("writeFileSync", "test/path/butThen/test.txt")],
|
|
17
|
+
"writeFileSync test"
|
|
18
|
+
),
|
|
19
|
+
createWriteStreamProxyTest: Given.SomeBaseString(
|
|
20
|
+
["butThenProxy should rewrite createWriteStream paths"],
|
|
21
|
+
[],
|
|
22
|
+
[Then.theButTheProxyReturns("createWriteStream", "test/path/butThen/stream.txt")],
|
|
23
|
+
"createWriteStream test"
|
|
24
|
+
),
|
|
25
|
+
screencastProxyTest: Given.SomeBaseString(
|
|
26
|
+
["butThenProxy should rewrite screencast paths"],
|
|
27
|
+
[],
|
|
28
|
+
[Then.theButTheProxyReturns("screencast", "test/path/butThen/screen.png")],
|
|
29
|
+
"screencast test"
|
|
30
|
+
),
|
|
31
|
+
customScreenShotProxyTest: Given.SomeBaseString(
|
|
32
|
+
["butThenProxy should rewrite customScreenShot paths"],
|
|
33
|
+
[],
|
|
34
|
+
[Then.theButTheProxyReturns("customScreenShot", "test/path/butThen/shot.png")],
|
|
35
|
+
"customScreenShot test"
|
|
36
|
+
),
|
|
37
|
+
|
|
38
|
+
// Edge cases
|
|
39
|
+
emptyPathTest: Given.SomeBaseString(
|
|
40
|
+
["butThenProxy should handle empty paths"],
|
|
41
|
+
[],
|
|
42
|
+
[Then.theButTheProxyReturns("writeFileSync", "test/path/butThen/")],
|
|
43
|
+
"empty path test"
|
|
44
|
+
),
|
|
45
|
+
nestedPathTest: Given.SomeBaseString(
|
|
46
|
+
["butThenProxy should handle nested paths"],
|
|
47
|
+
[],
|
|
48
|
+
[Then.theButTheProxyReturns("writeFileSync", "test/path/butThen/nested/folder/test.txt")],
|
|
49
|
+
"nested path test"
|
|
50
|
+
),
|
|
51
|
+
specialCharsTest: Given.SomeBaseString(
|
|
52
|
+
["butThenProxy should handle special characters in paths"],
|
|
53
|
+
[],
|
|
54
|
+
[Then.theButTheProxyReturns("writeFileSync", "test/path/butThen/file with spaces.txt")],
|
|
55
|
+
"special chars test"
|
|
56
|
+
),
|
|
57
|
+
}),
|
|
58
|
+
|
|
59
|
+
Suite.Default("Proxy Type Coverage", {
|
|
60
|
+
// Test all proxy types
|
|
61
|
+
butThenProxyTest: Given.SomeBaseString(
|
|
62
|
+
["butThenProxy should work correctly"],
|
|
63
|
+
[],
|
|
64
|
+
[Then.theButTheProxyReturns("writeFileSync", "test/path/butThen/test.txt")],
|
|
65
|
+
"butThenProxy test"
|
|
66
|
+
),
|
|
67
|
+
andWhenProxyTest: Given.SomeBaseString(
|
|
68
|
+
["andWhenProxy should work correctly"],
|
|
69
|
+
[],
|
|
70
|
+
[Then.theButTheProxyReturns("writeFileSync", "test/path/andWhen/test.txt")],
|
|
71
|
+
"andWhenProxy test"
|
|
72
|
+
),
|
|
73
|
+
beforeEachProxyTest: Given.SomeBaseString(
|
|
74
|
+
["beforeEachProxy should work correctly"],
|
|
75
|
+
[],
|
|
76
|
+
[Then.theButTheProxyReturns("writeFileSync", "suite-1/beforeEach/test.txt")],
|
|
77
|
+
"beforeEachProxy test"
|
|
78
|
+
),
|
|
79
|
+
afterEachProxyTest: Given.SomeBaseString(
|
|
80
|
+
["afterEachProxy should work correctly"],
|
|
81
|
+
[],
|
|
82
|
+
[Then.theButTheProxyReturns("writeFileSync", "suite-1/given-1/afterEach/test.txt")],
|
|
83
|
+
"afterEachProxy test"
|
|
84
|
+
),
|
|
85
|
+
}),
|
|
86
|
+
|
|
87
|
+
Suite.Default("Content Preservation", {
|
|
88
|
+
// Verify content is preserved
|
|
89
|
+
contentPreservationTest: Given.SomeBaseString(
|
|
90
|
+
["Proxies should preserve file content"],
|
|
91
|
+
[],
|
|
92
|
+
[
|
|
93
|
+
Then.theButTheProxyReturns("writeFileSync", "test/path/butThen/test.txt"),
|
|
94
|
+
Then.verifyContent("test content")
|
|
95
|
+
],
|
|
96
|
+
"content preservation test"
|
|
97
|
+
),
|
|
98
|
+
objectContentTest: Given.SomeBaseString(
|
|
99
|
+
["Proxies should preserve object content"],
|
|
100
|
+
[],
|
|
101
|
+
[
|
|
102
|
+
Then.theButTheProxyReturns("screencast", "test/path/butThen/screen.png"),
|
|
103
|
+
Then.verifyContent({quality: 80, fullPage: true})
|
|
104
|
+
],
|
|
105
|
+
"object content test"
|
|
106
|
+
),
|
|
107
|
+
}),
|
|
108
|
+
|
|
109
|
+
Suite.Default("Error Cases", {
|
|
110
|
+
invalidPathTest: Given.SomeBaseString(
|
|
111
|
+
["Proxies should handle invalid paths"],
|
|
112
|
+
[],
|
|
113
|
+
[Then.theButTheProxyReturns("writeFileSync", "test/path/butThen/../invalid.txt")],
|
|
114
|
+
"invalid path test"
|
|
115
|
+
),
|
|
116
|
+
undefinedInputTest: Given.SomeBaseString(
|
|
117
|
+
["Proxies should handle undefined inputs"],
|
|
118
|
+
[],
|
|
119
|
+
[Then.theButTheProxyReturns("writeFileSync", undefined)],
|
|
120
|
+
"undefined input test"
|
|
121
|
+
),
|
|
122
|
+
}),
|
|
123
|
+
];
|