risei 1.1.1 → 1.2.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 (45) hide show
  1. package/README.md +17 -16
  2. package/index.js +1 -1
  3. package/package.json +6 -5
  4. package/system/Risei.js +1 -1
  5. package/system/TestFinder.js +19 -3
  6. package/system/TestRunner.js +1 -1
  7. package/tests/other-tests/ASpoofingFixture.tests.js +0 -242
  8. package/tests/other-tests/SpoofClassesFixture.tests.js +0 -130
  9. package/tests/other-tests/SpoofObjectsFixture.tests.js +0 -95
  10. package/tests/other-tests/SpoofTuple.tests.js +0 -93
  11. package/tests/other-tests/TotalComparer.tests.js +0 -920
  12. package/tests/other-tests/package.json +0 -7
  13. package/tests/risei-tests/ASpoofingFixtureTests.rt.js +0 -51
  14. package/tests/risei-tests/MomentTests.rt.js +0 -103
  15. package/tests/risei-tests/SpoofTupleTests.rt.js +0 -274
  16. package/tests/risei-tests/TestFrameChooserTests.rt.js +0 -74
  17. package/tests/risei-tests/TestFrameTests.rt.js +0 -84
  18. package/tests/risei-tests/TestStagesTests.rt.js +0 -99
  19. package/tests/risei-tests/TestTupleTests.rt.js +0 -140
  20. package/tests/risei-tests/TotalComparerTests.rt.js +0 -184
  21. package/tests/risei-tests/TotalCopierTests.rt.js +0 -74
  22. package/tests/risei-tests/TotalDisplayerTests.rt.js +0 -186
  23. package/tests/risei-tests/TypeAnalyzerTests.rt.js +0 -29
  24. package/tests/risei-tests/TypeIdentifierTests.rt.js +0 -44
  25. package/tests/self-tests/SelfTests.outward-rt.js +0 -583
  26. package/tests/target-objects/CompositionModel.js +0 -38
  27. package/tests/target-objects/ConditionalThrowModel.js +0 -11
  28. package/tests/target-objects/CountModel.js +0 -46
  29. package/tests/target-objects/DomModel.js +0 -37
  30. package/tests/target-objects/MixedContents.js +0 -33
  31. package/tests/target-objects/MutationModel.js +0 -27
  32. package/tests/target-objects/ObjectCompositionModel.js +0 -34
  33. package/tests/target-objects/PolySpoofableInner.js +0 -30
  34. package/tests/target-objects/PolySpoofableOuter.js +0 -52
  35. package/tests/target-objects/PropertiesModel.js +0 -47
  36. package/tests/target-objects/Returner.js +0 -9
  37. package/tests/target-objects/SearchModel.js +0 -25
  38. package/tests/target-objects/SortModel.js +0 -91
  39. package/tests/target-objects/SpoofCaller.js +0 -24
  40. package/tests/target-objects/Spoofable.js +0 -36
  41. package/tests/target-objects/SpoofableArgsCaller.js +0 -33
  42. package/tests/target-objects/StateModel.js +0 -34
  43. package/tests/target-objects/StaticModel.js +0 -17
  44. package/tests/target-objects/TestableModel.js +0 -47
  45. package/tests/topic-tests/TopicTests.outward-rt.js +0 -354
@@ -1,7 +0,0 @@
1
- {
2
- "name": "mocha-tests",
3
- "version": "1.0.0",
4
- "type": "module",
5
- "dependencies": {
6
- }
7
- }
@@ -1,51 +0,0 @@
1
- /**/
2
-
3
- import { ATestSource } from "../../node_modules/risei/public/javascript/ATestSource.js";
4
- import { ASpoofingFixture } from "../../system/ASpoofingFixture.js";
5
- import { SpoofTuple } from "../../system/SpoofTuple.js";
6
-
7
- export class ASpoofingFixtureTests extends ATestSource {
8
- // region Fixture members
9
-
10
- objectWithValueProperty = { something: "value-something" }
11
-
12
- // endregion Fixture members
13
-
14
- tests = [
15
- { on: ASpoofingFixture, with: [ ] },
16
-
17
- { of: "spoofMethod" },
18
- { for: "When given no args, returns an empty function.", /* good */
19
- in: [ ],
20
- out: () => { }
21
- },
22
- { for: "When given a simple value, returns a nonce that returns a symbol containing that value.", /* good */
23
- in: [ 12 ],
24
- out: () => { return spoofOutput; }
25
- },
26
- { for: "When given a function, returns that function.", /* good */
27
- in: [ () => { return a + b; } ],
28
- out: () => { return a + b; }
29
- },
30
-
31
- /* &cruft, restore when df version supports test.actual */
32
- // { for: "When given an array of spoof tuples, returns output of spoofObjectTree().", /* good */
33
- // plus: [ { of: "spoofObjectTree", as: "spoofObjectTree-output" } ],
34
- // in: [ [ new SpoofTuple("a", "b", "c"), new SpoofTuple(1, 2, 3) ] ],
35
- // from: (target, test) => { return test.actual(); },
36
- // out: "spoofObjectTree-output"
37
- // },
38
-
39
- ];
40
- }
41
-
42
- // region Fixture types
43
-
44
- class ClassWithGetter {
45
- get something() {
46
- return "getter-something";
47
- }
48
- }
49
-
50
- // endregion Fixture types
51
-
@@ -1,103 +0,0 @@
1
- /**/
2
-
3
- import { ATestSource } from "../../node_modules/risei/public/javascript/ATestSource.js";
4
- import { Moment } from "../../system/Moment.js";
5
-
6
- import { SpoofCaller } from "../target-objects/SpoofCaller.js";
7
- import { SpoofTuple } from "../../system/SpoofTuple.js";
8
- import { Spoofable } from "../target-objects/Spoofable.js";
9
- import { PolySpoofableOuter } from "../target-objects/PolySpoofableOuter.js";
10
- import { PolySpoofableInner } from "../target-objects/PolySpoofableInner.js";
11
- import { ObjectCompositionModel } from "../target-objects/ObjectCompositionModel.js";
12
-
13
- export class MomentTests extends ATestSource {
14
- // region Fields
15
-
16
- #sameObject = { a: "b" };
17
-
18
- // endregion Fields
19
-
20
- // region Tests
21
-
22
- tests = [
23
- { on: Moment, of: "asReadable" },
24
- /* The date-time input is in the constructor arguments, so .with, and no .in contents are needed. */
25
- /* Without final `Z`, the long date-time formats used are local times. */
26
-
27
- { for: "When given a date with a time before noon, returns less than twelve and AM.", /* good */
28
- with: [ new Date("2024-10-08T08:45:37.143") ],
29
- in: [], out: "10/08/2024 at 8:45:37 AM" },
30
- { for: "When given a date with a time after noon, returns greater than twelve and PM.", /* good */
31
- with: [ new Date("2024-10-08T18:45:37.143") ],
32
- in: [], out: "10/08/2024 at 6:45:37 PM" },
33
- { for: "When given a date with noon, returns twelve and PM.", /* good */
34
- with: [ new Date("2026-08-10T12:00:00.000") ],
35
- in: [], out: "8/10/2026 at 12:00:00 PM" },
36
- { for: "When given a date with midnight, returns twelve and AM.", /* good */
37
- with: [ new Date("2026-08-10T24:00:00.000") ],
38
- in: [], out: "8/11/2026 at 12:00:00 AM" }, /* Midnight of day D is treated as day D +1. */
39
- { for: "When given a date with a time in the noon hour, returns twelve and PM.", /* good */
40
- with: [ new Date("2024-10-08T12:21:07.143") ],
41
- in: [], out: "10/08/2024 at 12:21:07 PM" },
42
- { for: "When given a date with a time in the midnight hour, returns twelve and AM.", /* good */
43
- with: [ new Date("2024-10-08T00:21:07.143") ],
44
- in: [], out: "10/08/2024 at 12:21:07 AM" },
45
-
46
- { for: "When given a date with a one-digit day, returns day with a leading zero.", /* good */
47
- with: [ new Date("2026-10-07T13:03:02.000") ],
48
- in: [], out: "10/07/2026 at 1:03:02 PM" },
49
- { for: "When given a date with a two-digit day, returns day digits unchanged.", /* good */
50
- with: [ new Date("2026-08-12T14:06:02.000") ],
51
- in: [], out: "8/12/2026 at 2:06:02 PM" },
52
- { for: "When given a date with a month less than ten, returns month without a leading zero.", /* good */
53
- with: [ new Date("2024-06-16T10:24:12.000") ],
54
- in: [], out: "6/16/2024 at 10:24:12 AM" },
55
- { for: "When given a date with a month greater than ten, returns month unchanged.", /* good */
56
- with: [ new Date("2024-11-16T10:32:14.000") ],
57
- in: [], out: "11/16/2024 at 10:32:14 AM" },
58
- { for: "When given a date in January, returns month of 1, not 0.", /* good */
59
- with: [ new Date("2028-01-14T23:23:43.000") ], /* JS internal month handling (only) is zero-based. */
60
- in: [], out: "1/14/2028 at 11:23:43 PM" },
61
-
62
- ];
63
-
64
- // endregion Tests
65
-
66
- // region Local test fixtures
67
-
68
- supplySingleElementSpoofArray() {
69
- return [ { of: "spoofNumber", as: 32 } ]
70
- }
71
-
72
- supplySpoofNumberDefinition(target, test) {
73
- /* Method members are defined on the prototype,
74
- not on instances, so they are found this way. */
75
-
76
- let args = test.in;
77
- let spoofableClass = args[0];
78
- return spoofableClass.prototype.spoofNumber;
79
- }
80
-
81
- supplySpoofTextDefinition(target, test) {
82
- /* Method members are defined on the prototype,
83
- not on instances, so they are found this way. */
84
-
85
- let args = test.in;
86
- let spoofableClass = args[0];
87
- return spoofableClass.prototype.spoofText;
88
- }
89
-
90
- supplyArgsForCombineValuesTest() {
91
- let args = [];
92
-
93
- let self = { target: "target-arg", method: "method-arg", not: true };
94
- let other = { target: "target-arg", method: "method-arg", output: "output-arg", not: true };
95
-
96
- args.push(self, other);
97
- args.push("output")
98
-
99
- return args;
100
- }
101
-
102
- // endregion Local test fixtures
103
- }
@@ -1,274 +0,0 @@
1
- /**/
2
-
3
- import { ATestSource } from "../../node_modules/risei/public/javascript/ATestSource.js";
4
- import { Moment } from "../../system/Moment.js";
5
-
6
- import { SpoofCaller } from "../target-objects/SpoofCaller.js";
7
- import { SpoofTuple } from "../../system/SpoofTuple.js";
8
- import { Spoofable } from "../target-objects/Spoofable.js";
9
- import { PolySpoofableOuter } from "../target-objects/PolySpoofableOuter.js";
10
- import { PolySpoofableInner } from "../target-objects/PolySpoofableInner.js";
11
- import { ObjectCompositionModel } from "../target-objects/ObjectCompositionModel.js";
12
- import { PropertiesModel } from "../target-objects/PropertiesModel.js";
13
-
14
- export class SelfTests extends ATestSource {
15
- // region Fields
16
-
17
- #sameObject = { a: "b" };
18
-
19
- // endregion Fields
20
-
21
- // region Tests
22
-
23
- tests = [
24
- { on: SpoofTuple, with: [ ] },
25
-
26
- /* SpoofTuple static methods. */
27
- { of: "combineValues", and: "static" },
28
- { for: "With a property on `other` but not `self`, value on `other` is applied to `self`.", /* good */
29
- in: [
30
- { target: "on-arg", method: "of-arg", not: true },
31
- { target: "on-arg", method: "of-arg", output: "other-as", not: true },
32
- "output"
33
- ],
34
- out: "other-as",
35
- from: (target, test) => {
36
- let self = test.in[0]; // The input arg has been mutated.
37
- return self.output;
38
- }
39
- },
40
- { for: "With a property already defined on `self`, value on `other` is not applied to `self`.", /* good */
41
- in: [
42
- { target: "on-arg", method: "of-arg", output: "self-as", not: true },
43
- { target: "on-arg", method: "of-arg", output: "other-as", not: true },
44
- "output"
45
- ],
46
- out: "self-as",
47
- from: (target, test) => {
48
- let self = test.in[0]; // The input arg has been mutated.
49
- return self.output;
50
- }
51
- },
52
- { for: "When a property is undefined on `self` and `other`, it remains undefined.", /* good */
53
- in: [
54
- { target: "on-arg", output: "as-arg", not: true },
55
- { target: "on-arg", output: "as-arg", not: true },
56
- "method"
57
- ],
58
- out: "self.method: undefined",
59
- from: (target, test) => {
60
- let self = test.in[0]; // The input arg has been mutated.
61
- return self.method === undefined ? "self.method: undefined" : self.method;
62
- }
63
- },
64
-
65
- { of: "maybeRestartFull", and: "static" },
66
- { for: "When `latest` doesn't have `target` defined, `full` is returned.", /* good */
67
- in: [
68
- { target: "full-on", method: "full-of", output: "full-as", not: true },
69
- { output: "latest-as", method: "latest-of", not: true }
70
- ],
71
- out: { target: "full-on", method: "full-of", output: "full-as", not: true }
72
- },
73
- { for: "When `latest` does have `target` defined, `latest` is returned.", /* good */
74
- in: [
75
- { target: "full-on", method: "full-of", output: "full-as", not: true },
76
- { target: "new-on", method: "new-of", output: "new-as", not: true }
77
- ],
78
- out: { target: "new-on", method: "new-of", output: "new-as", not: true }
79
- },
80
-
81
- { of: "fromNonceTuple", and: "static" },
82
- { for: "When the nonce has all long-named properties, all properties are set.", /* good */
83
- in: [
84
- { target: "target", method: "method", output: "output", not: true }
85
- ],
86
- out: new SpoofTuple("target", "method", "output")
87
- },
88
- { for: "When the nonce has all short-named properties, all properties are set.", /* good */
89
- in: [
90
- { on: "target", of: "method", as: "output", not: true }
91
- ],
92
- out: new SpoofTuple("target", "method", "output")
93
- },
94
- { for: "When the nonce has all properties with mixed short and long names, all properties are set.", /* good */
95
- in: [
96
- { on: "target", method: "method", as: "output", not: true }
97
- ],
98
- out: new SpoofTuple("target", "method", "output")
99
- },
100
- { for: "When the nonce has some properties with mixed short and long names, just those properties are set.", /* good */
101
- in: [
102
- { on: "on-arg", method: "as-arg", notAs: "not-as", not: true }
103
- ],
104
- out: new SpoofTuple("on-arg", "as-arg")
105
- },
106
- { for: "When the nonce has no SpoofTuple properties, those output properties are not set.", /* good */
107
- in: [ { notASpoofTuple: true, nonceOfSpoofTuple: false } ],
108
- out: new SpoofTuple() },
109
-
110
- /* SpoofTuple instance methods. */
111
- { of: "constructor" },
112
- { for: "When constructed, .on is the same as the `target` arg.", /* good */
113
- in: [ "target-arg", "method-arg", "spoof-arg" ],
114
- out: "target-arg",
115
- from: "on"
116
- },
117
- { for: "When constructed, .target is the same as the `target` arg.", /* good */
118
- in: [ "target-arg", "method-arg", "spoof-arg" ],
119
- out: "target-arg",
120
- from: "target"
121
- },
122
- { for: "When constructed, .of is the same as the `method` arg.", /* good */
123
- in: [ "target-arg", "method-arg", "spoof-arg" ],
124
- out: "method-arg",
125
- from: "of"
126
- },
127
- { for: "When constructed, .method is the same as the `method` arg.", /* good */
128
- in: [ "target-arg", "method-arg", "spoof-arg" ],
129
- out: "method-arg",
130
- from: "method"
131
- },
132
- { for: "When constructed, .as is the same as the `output` arg.", /* good */
133
- in: [ "target-arg", "method-arg", "spoof-arg" ],
134
- out: "spoof-arg",
135
- from: "as"
136
- },
137
- { for: "When constructed, .output is the same as the `output` arg.", /* good */
138
- in: [ "target-arg", "method-arg", "spoof-arg" ],
139
- out: "spoof-arg",
140
- from: "output"
141
- },
142
-
143
- { of: "toString" },
144
- { for: "When any properties are strings, they are written with quotes.", /* good */
145
- on: SpoofTuple,
146
- with: [ "on-arg", "of-arg", "as-arg" ],
147
- in: [ ],
148
- out: `SpoofTuple:{ target:"on-arg", method:"of-arg", output:"as-arg" }`
149
- },
150
- { for: "When any properties are not strings, they are written without quotes.", /* good */
151
- on: SpoofTuple,
152
- with: [ true, false, 27 ],
153
- in: [ ],
154
- out: `SpoofTuple:{ target:true, method:false, output:27 }`
155
- },
156
-
157
- { of: "isSpoofable" },
158
- { for: "When instance doesn't have .target, .method, or .output, returns false.",
159
- with: [ undefined, undefined, undefined ],
160
- in: [ ],
161
- out: false },
162
- { for: "When instance has .target but not .method or .output, returns false.",
163
- with: [ "target-arg", undefined, undefined ],
164
- in: [ ],
165
- out: false },
166
- { for: "When instance has .method but not .target or .output, returns true.",
167
- with: [ undefined, "method-arg", undefined ],
168
- in: [ ],
169
- out: true },
170
- { for: "When instance has .output but not .target or .method, returns true.",
171
- with: [ undefined, undefined, "as-arg" ],
172
- in: [ ],
173
- out: true },
174
- { for: "When instance has .target and .method, returns true.",
175
- with: [ "on-arg", "of-arg", undefined ],
176
- in: [ ],
177
- out: true },
178
- { for: "When instance has .target and .output, returns true.",
179
- with: [ "on-arg", undefined, "as-arg" ],
180
- in: [ ],
181
- out: true },
182
- { for: "When instance has .method and .output, returns true.",
183
- with: [ undefined, "of-arg", "as-arg" ],
184
- in: [ ],
185
- out: true },
186
- { for: "When instance has valid contents plus other args, returns true.", /* good */
187
- with: [ undefined, "of-arg", "as-arg", "frip", "sliff" ],
188
- in: [ ],
189
- out: true },
190
-
191
- { of: "isNotASpoof", and: "static" },
192
- { for: "When arg contains SpoofTuple properties but also .not, returns true.", /* good */
193
- in: [ { on: "on-arg", of: "of-arg", as: "as-arg", not: true } ],
194
- out: true },
195
- { for: "When arg contains SpoofTuple properties but also .skip, returns true.", /* good */
196
- in: [ { on: "on-arg", of: "of-arg", as: "as-arg", skip: true } ],
197
- out: true },
198
- { for: "When arg doesn't contain any SpoofTuple properties, returns true.", /* good */
199
- in: [ { notOn: true, notOf: "true", notAs: "not-as" } ],
200
- out: true },
201
- { for: "Tests of returns-false cases can't readily be tested within this system itself.", /* good */
202
- of: null },
203
-
204
- { of: "fromNonceTuples", and: "static" },
205
- { for: "When nonces are not SpoofTuple equivalents, returns nonces unaltered.", /* good */
206
- in: [ [ { first: "first", and: true }, { second: "second", and: false } ] ],
207
- out: [ { first: "first", and: true }, { second: "second", and: false } ] },
208
-
209
- { for: "Tests of returns-SpoofTuple cases can't readily be tested within this system itself.", /* good */
210
- of: null },
211
-
212
- { of: "isPropertySpoof", and: "nospoof" },
213
- { for: "When .of is the name of an instance value property, returns true.", /* good */
214
- with: [ PropertiesModel, "valueProp", 7 ],
215
- in: [ ], out: true },
216
- { for: "When .of is the name of an instance accessor property, returns true.", /* good */
217
- with: [ PropertiesModel, "accessorProp", 10 ],
218
- in: [ ], out: true },
219
- { for: "When .of is the name of an instance method, returns false.", /* good */
220
- with: [ PropertiesModel, "instanceMethod", 15 ],
221
- in: [ ], out: false },
222
-
223
- { for: "When .of is the name of a static value property, returns true.", /* good */
224
- with: [ PropertiesModel, "staticValueProp", 20 ],
225
- in: [ ], out: true },
226
- { for: "When .of is the name of a static accessor property, returns true.", /* good */
227
- with: [ PropertiesModel, "staticAccessorProp", 25 ],
228
- in: [ ], out: true },
229
- { for: "When .of is the name of a static method, returns false.", /* good */
230
- with: [ PropertiesModel, "staticMethod", 60 ],
231
- in: [ ], out: false },
232
-
233
- ];
234
-
235
- // endregion Tests
236
-
237
- // region Local test fixtures
238
-
239
- supplySingleElementSpoofArray() {
240
- return [ { of: "spoofNumber", as: 32 } ]
241
- }
242
-
243
- supplySpoofNumberDefinition(target, test) {
244
- /* Method members are defined on the prototype,
245
- not on instances, so they are found this way. */
246
-
247
- let args = test.in;
248
- let spoofableClass = args[0];
249
- return spoofableClass.prototype.spoofNumber;
250
- }
251
-
252
- supplySpoofTextDefinition(target, test) {
253
- /* Method members are defined on the prototype,
254
- not on instances, so they are found this way. */
255
-
256
- let args = test.in;
257
- let spoofableClass = args[0];
258
- return spoofableClass.prototype.spoofText;
259
- }
260
-
261
- supplyArgsForCombineValuesTest() {
262
- let args = [];
263
-
264
- let self = { target: "target-arg", method: "method-arg", not: true };
265
- let other = { target: "target-arg", method: "method-arg", output: "output-arg", not: true };
266
-
267
- args.push(self, other);
268
- args.push("output")
269
-
270
- return args;
271
- }
272
-
273
- // endregion Local test fixtures
274
- }
@@ -1,74 +0,0 @@
1
- /**/
2
-
3
- import { ATestSource } from "../../node_modules/risei/public/javascript/ATestSource.js";
4
- import { TestFrameChooser } from "../../system/TestFrameChooser.js";
5
- import { TestTuple } from "../../system/TestTuple.js";
6
-
7
- export class TestFrameChooserTests extends ATestSource {
8
- tests = [
9
- { on: TestFrameChooser, with: [ new SpoofTestFrameSource() ], and: "nospoof" },
10
-
11
- { of: "supplyTestFrame" },
12
- { for: "When no other conditions apply, returns source's .testReturnValueOfCall().", /* good */
13
- plus: [ { of: "isStaticTest", as: false }, { of: "isRetrievalTest", as: false } ],
14
- in: [ new TestTuple("", "", "", "", "", "", "", "", "", "") ], // No test-tuple properties defined.
15
- out: SpoofTestFrameSource.prototype.testReturnValueOfCall
16
- },
17
-
18
- { on: TestFrameChooser, of: "supplyTestFrame", with: [ new SpoofTestFrameSource() ], and: "nospoof" }, // Wiping spoofs.
19
-
20
- { for: "When .and is \"static\" and .from is defined, returns source's .testCodeElementAfterStaticCall().", /* good */
21
- in: [ new TestTuple("", "", "", "", "", "", "", "", "some-value", "static") ],
22
- out: SpoofTestFrameSource.prototype.testCodeElementAfterStaticCall },
23
- { for: "When .and is \"static\" and .from isn't defined, returns source's .testReturnValueOfStaticCall().", /* good */
24
- in: [ new TestTuple("", "", "", "", "", "", "", "", undefined, "static") ],
25
- out: SpoofTestFrameSource.prototype.testReturnValueOfStaticCall },
26
- { for: "When .target (.of) is \"constructor\", returns source's .testCodeElementAfterConstruction().", /* good */
27
- in: [ new TestTuple("", "", "", "", "", "constructor", "", "", "", "") ],
28
- out: SpoofTestFrameSource.prototype.testCodeElementAfterConstruction },
29
- { for: "When not static and .from is a string, returns source's .testCodeElementAfterCall().", /* good */
30
- in: [ new TestTuple("", "", "", "", "", "", "", "", "property", "") ],
31
- out: SpoofTestFrameSource.prototype.testCodeElementAfterCall },
32
- { for: "When not static and .from is a function, returns source's .testCodeElementAfterCall().", /* good */
33
- in: [ new TestTuple("", "", "", "", "", "", "", "", () => { }, "") ],
34
- out: SpoofTestFrameSource.prototype.testCodeElementAfterCall },
35
-
36
- { for: "When .and contains just \"throw\", returns source's .testThrowResultAfterCall().", /* good */
37
- in: [ new TestTuple("", "", "", "", "", "", "", "", "", "throw") ],
38
- out: SpoofTestFrameSource.prototype.testThrowResultAfterCall },
39
- { for: "When .and contains just \"throws\", returns source's .testThrowResultAfterCall().", /* good */
40
- in: [ new TestTuple("", "", "", "", "", "", "", "", "", "throws") ],
41
- out: SpoofTestFrameSource.prototype.testThrowResultAfterCall },
42
- { for: "When .and contains \"static\" and \"throw\", returns source's .testThrowResultAfterStaticCall().", /* good */
43
- in: [ new TestTuple("", "", "", "", "", "", "", "", "", "static throw") ],
44
- out: SpoofTestFrameSource.prototype.testThrowResultAfterStaticCall },
45
- { for: "When .and contains \"static\" and \"throws\", returns source's .testThrowResultAfterStaticCall().", /* good */
46
- in: [ new TestTuple("", "", "", "", "", "", "", "", "", "throws static") ],
47
- out: SpoofTestFrameSource.prototype.testThrowResultAfterStaticCall },
48
- ];
49
-
50
- // region Test fixtures
51
-
52
- spoofTestTupleWith(factors) {
53
- let spoof = new TestTuple();
54
- spoof.factors = factors;
55
- return spoof;
56
- }
57
-
58
- // endregion Test fixtures
59
- }
60
-
61
- // region Test-fixture classes
62
-
63
- class SpoofTestFrameSource {
64
- testReturnValueOfCall() { }
65
- testReturnValueOfStaticCall() { }
66
- testCodeElementAfterCall() { }
67
- testCodeElementAfterStaticCall() { }
68
- testCodeElementAfterConstruction() { }
69
- testThrowResultAfterCall() { }
70
- testThrowResultAfterStaticCall() { }
71
- }
72
-
73
- // endregion Test-fixture classes
74
-
@@ -1,84 +0,0 @@
1
- /**/
2
-
3
- import { ATestSource } from "../../node_modules/risei/public/javascript/ATestSource.js";
4
- import { TestFrame } from "../../system/TestFrame.js";
5
- import { TestTuple } from "../../system/TestTuple.js";
6
- import { TestStages } from "../../system/TestStages.js";
7
- import { TestableModel } from "../target-objects/TestableModel.js";
8
-
9
- let supplyTopicTestProperty = (testArg, name) /* verified */ => {
10
- let testDef = testArg.in[0];
11
- return testDef[name];
12
- };
13
-
14
- export class TestFrameTests extends ATestSource {
15
- tests = [
16
- { on: TestFrame, with: [ ] },
17
-
18
- { of: "testFrame", and: "nospoof" },
19
-
20
- /* &cruft, remove when no longer needed */
21
- // { for: "When given ..., ...",
22
- // in: [ new TestTuple() ],
23
- // out: "output not set yet",
24
- // from: (target, test) => { return supplyTopicTestProperty(test, "name"); }
25
- // },
26
-
27
- /* &cruft, enable and finish each of these tests, getting target method to pass each */
28
-
29
- { for: "When given an instance method to test whose output equals .out, sets .didPass to true.", /* good */
30
- in: [ new TestTuple("", TestableModel, [ ], [ ], [ ], "instanceMethod", [ 1, "B" ], "instance-method-1-B", [ ], [ ] ) ],
31
- out: true,
32
- from: (target, test) => { return supplyTopicTestProperty(test, "didPass"); }
33
- },
34
- { for: "When given an instance method to test whose output doesn't equal .out, sets .didPass to false.", /* good */
35
- in: [ new TestTuple("", TestableModel, [ ], [ ], [ ], "instanceMethod", [ 1, "A" ], "instance-method-1-C", [ ], [ ] ) ],
36
- out: false,
37
- from: (target, test) => { return supplyTopicTestProperty(test, "didPass"); }
38
- },
39
-
40
- // { for: "When given a static method to test whose output equals .out, sets .didPass to true.",
41
- // in: [ new TestTuple() ],
42
- // out: true,
43
- // from: (target, test) => { return supplyTopicTestProperty(test, "didPass"); }
44
- // },
45
- // { for: "When given a static method to test whose output doesn't equal .out, sets .didPass to false.",
46
- // in: [ new TestTuple() ],
47
- // out: false,
48
- // from: (target, test) => { return supplyTopicTestProperty(test, "didPass"); }
49
- // },
50
- //
51
- // { for: "When given an instance property to test whose value equals .out, sets .didPass to true.",
52
- // in: [ new TestTuple() ],
53
- // out: true,
54
- // from: (target, test) => { return supplyTopicTestProperty(test, "didPass"); }
55
- // },
56
- // { for: "When given an instance property to test whose value doesn't equal .out, sets .didPass to false.",
57
- // in: [ new TestTuple() ],
58
- // out: false,
59
- // from: (target, test) => { return supplyTopicTestProperty(test, "didPass"); }
60
- // },
61
- //
62
- // { for: "When given a static property to test whose value equals .out, sets .didPass to true.",
63
- // in: [ new TestTuple() ],
64
- // out: true,
65
- // from: (target, test) => { return supplyTopicTestProperty(test, "didPass"); }
66
- // },
67
- // { for: "When given a static property to test whose value doesn't equal .out, sets .didPass to false.",
68
- // in: [ new TestTuple() ],
69
- // out: false,
70
- // from: (target, test) => { return supplyTopicTestProperty(test, "didPass"); }
71
- // },
72
-
73
- /* &cruft, also all of these:
74
- instance method + .from name;
75
- instance method + .from function;
76
- static method + .from name;
77
- static method + .from function;
78
- ... same for properties... ;
79
- ... same but with spoofing... ;
80
- ... everything else needed...
81
- */
82
-
83
- ];
84
- }