risei 2.0.0 → 2.0.1

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 (33) hide show
  1. package/README.md +114 -222
  2. package/package.json +1 -1
  3. package/Read-me reduced.md +0 -294
  4. package/Read-me redux.md +0 -581
  5. package/test-target-objects/ConditionalThrowTarget.js +0 -11
  6. package/test-target-objects/Counter.js +0 -46
  7. package/test-target-objects/DomTarget.js +0 -37
  8. package/test-target-objects/InterSpoofer.js +0 -230
  9. package/test-target-objects/MixedContents.js +0 -33
  10. package/test-target-objects/MutationTarget.js +0 -37
  11. package/test-target-objects/ObjectComposer.js +0 -34
  12. package/test-target-objects/PolySpoofableInner.js +0 -29
  13. package/test-target-objects/PolySpoofableOuter.js +0 -52
  14. package/test-target-objects/PropertiesTarget.js +0 -98
  15. package/test-target-objects/Returner.js +0 -7
  16. package/test-target-objects/Searcher.js +0 -25
  17. package/test-target-objects/Sorter.js +0 -91
  18. package/test-target-objects/Spoofable.js +0 -36
  19. package/test-target-objects/StateTarget.js +0 -34
  20. package/test-target-objects/StaticTarget.js +0 -17
  21. package/test-target-objects/TestableTarget.js +0 -57
  22. package/trial-tests/SelfTests.outward-rt.js +0 -511
  23. package/trial-tests/TopicTests.outward-rt.js +0 -313
  24. package/usage-examples/Gold-bar-example.png +0 -0
  25. package/usage-examples/Output-example.png +0 -0
  26. package/usage-examples/Summary-example.png +0 -0
  27. package/usage-examples/Syntax-example.png +0 -0
  28. package/usage-examples/Title-example.png +0 -0
  29. package/xternal-tests/ASpoofingFixture.tests.js +0 -242
  30. package/xternal-tests/MethodSpoofer.tests.js +0 -130
  31. package/xternal-tests/SpoofDef.tests.js +0 -91
  32. package/xternal-tests/TotalComparer.tests.js +0 -1055
  33. package/xternal-tests/package.json +0 -7
@@ -1,34 +0,0 @@
1
- /**/
2
-
3
- export default class StateTarget {
4
- #numberState;
5
- #textState;
6
-
7
- get numberState() {
8
- return this.#numberState;
9
- }
10
-
11
- get textState() {
12
- return this.#textState;
13
- }
14
-
15
- constructor() {
16
- this.#numberState = 1;
17
- this.#textState = "1";
18
- }
19
-
20
- setNumberState(number) {
21
- this.#numberState = number;
22
- }
23
-
24
- setTextState(text) {
25
- this.#textState = text;
26
- }
27
-
28
- changeNumberAndTextState(number, text) {
29
- this.#numberState = number;
30
- this.#textState = text;
31
-
32
- return { number: this.#numberState, text: this.#textState };
33
- }
34
- }
@@ -1,17 +0,0 @@
1
- /**/
2
-
3
- export default class StaticTarget {
4
- static #property = "default-static-property";
5
-
6
- static get staticProperty() {
7
- return StaticTarget.#property;
8
- }
9
-
10
- static setStaticProperty(value) {
11
- StaticTarget.#property = value;
12
- }
13
-
14
- static multiplyThenDivide(a, b, c) {
15
- return (a * b) / c;
16
- }
17
- }
@@ -1,57 +0,0 @@
1
- /**/
2
-
3
- export default class TestableTarget {
4
- // region Static members
5
-
6
- static staticValueProp = 3;
7
-
8
- static #staticAccessorValue = "4th";
9
-
10
- static get staticAccessorProp() {
11
- return this.#staticAccessorValue;
12
- }
13
-
14
- static set staticAccessorProp(value) {
15
- this.#staticAccessorValue = value;
16
- }
17
-
18
- static staticMethod() {
19
- return "static";
20
- }
21
-
22
- static staticThrower() {
23
- // You don't have to throw an Error object.
24
- throw "Throw by staticThrower().";
25
- }
26
-
27
- // endregion Static members
28
-
29
- constructor() {
30
- /* No operations. */
31
- }
32
-
33
- // region Instance members
34
-
35
- valueProp = 1;
36
-
37
- #accessorValue = "2nd";
38
-
39
- get accessorProp() {
40
- return this.#accessorValue;
41
- }
42
-
43
- set accessorProp(value) {
44
- this.#accessorValue = value;
45
- }
46
-
47
- instanceMethod(argOne, argTwo) {
48
- return `instance-method-${ argOne }-${ argTwo }`;
49
- }
50
-
51
- instanceThrower() {
52
- // You don't have to throw an Error object.
53
- throw "Throw by instanceThrower()."
54
- }
55
-
56
- // endregion Instance members
57
- }
@@ -1,511 +0,0 @@
1
- /**/
2
-
3
- import ATestSource from "risei/ATestSource"; // Path must match class used in TestFinder.
4
-
5
- import Spoofable from "../test-target-objects/Spoofable.js";
6
- import ObjectComposer from "../test-target-objects/ObjectComposer.js";
7
- import PolySpoofableOuter from "../test-target-objects/PolySpoofableOuter.js";
8
- import PolySpoofableInner from "../test-target-objects/PolySpoofableInner.js";
9
- import ConditionalThrowTarget from "../test-target-objects/ConditionalThrowTarget.js";
10
- import MixedContents from "../test-target-objects/MixedContents.js";
11
- import Returner from "../test-target-objects/Returner.js";
12
- import Moment from "../system/Moment.js";
13
- import MutationTarget from "../test-target-objects/MutationTarget.js";
14
- import TestableTarget from "../test-target-objects/TestableTarget.js";
15
-
16
- export default class SelfTests extends ATestSource {
17
- // region Fields
18
-
19
- #sameObject = { a: "b" };
20
-
21
- // endregion Fields
22
-
23
- // region Local test fixtures
24
-
25
- supplySingleElementSpoofArray() {
26
- return [ { of: "spoofNumber", as: 32 } ]
27
- }
28
-
29
- supplySpoofNumberDefinition(target, test) {
30
- /* Method members are defined on the prototype,
31
- not on instances, so they are found this way. */
32
-
33
- let args = test.in;
34
- let spoofableClass = args[0];
35
- return spoofableClass.prototype.spoofNumber;
36
- }
37
-
38
- supplySpoofTextDefinition(target, test) {
39
- /* Method members are defined on the prototype,
40
- not on instances, so they are found this way. */
41
-
42
- let args = test.in;
43
- let spoofableClass = args[0];
44
- return spoofableClass.prototype.spoofText;
45
- }
46
-
47
- supplyArgsForCombineValuesTest() {
48
- let args = [];
49
-
50
- let self = { target: "target-arg", method: "method-arg", not: true };
51
- let other = { target: "target-arg", method: "method-arg", output: "output-arg", not: true };
52
-
53
- args.push(self, other);
54
- args.push("output")
55
-
56
- return args;
57
- }
58
-
59
- // endregion Local test fixtures
60
-
61
- // region Tests
62
-
63
- tests = [
64
- /* &cruft, ? remove / refashion these indirect tests of MethodSpoofer after direct testing finished */
65
-
66
- { on: Spoofable, with: [] },
67
- { for: "When a method is spoofed with no return value, calling it doesn't return anything.", /* good */
68
- plus: [ { of: "spoofNumber" } ], /* The actual spoofing. */
69
- /* Calling indirectly so that .out doesn't have to be `undefined`. */
70
- of: "callSpoofNumber",
71
- in: [ 8, 17 ],
72
- /* Can't set .out to `undefined`, since it's not a full test then. */
73
- out: "spoofNumber() internal call: no return value"
74
- },
75
- { for: "When a method is spoofed with a return value, calling it returns that value.", /* good */
76
- plus: [ { of: "spoofNumber", as: 10 } ], /* The actual spoofing. */
77
- of: "spoofNumber", in: [ 8, 17 ], out: 10 },
78
- { for: "When a method is spoofed with a return simple object, calling it returns that object.", /* good */
79
- plus: [ { of: "spoofNumber", as: { a: 3, b: "4", c: 5, d: "six" } } ], /* The actual spoofing. */
80
- of: "spoofNumber", in: [ 8, 17 ], out: { a: 3, b: "4", c: 5, d: "six" } },
81
- { for: "When a method is spoofed with to return a specialized object, calling it returns that object.", /* good */
82
- plus: [ { of: "spoofNumber", as: new Map([[1, "first"], [2, "second"]]) } ], /* The actual spoofing. */
83
- of: "spoofNumber", in: [ 7, 18 ], out: new Map([[1, "first"], [2, "second"]]) },
84
-
85
- { for: "When a method is spoofed with code, calling it enacts that code.", /* good */
86
- plus: [ { of: "spoofNumber", as: function (a, b) { return a - b; } } ],
87
- of: "spoofNumber", in: [ 12, 8 ], out: 4 },
88
- { for: "When a method is spoofed with code, the method definition matches the spoof.", /* good */
89
- plus: [ { of: "spoofNumber", as: (a, b) => { return a * b; } } ],
90
- of: "spoofNumber", in: [ 12, 12 ], out: (a, b) => { return a * b; },
91
- from: (target) => {
92
- let prototype = Object.getPrototypeOf(target);
93
- return prototype.spoofNumber;
94
- }
95
- },
96
-
97
- { for: "When a method is not spoofed, the original method definition still exists.", /* good */
98
- of: "spoofNumber",
99
- plus: [ ], /* Nothing is spoofed, but existing spoofing must be cleared. */
100
- in: [ 12, 12 ], out: function spoofNumber(a, b) { return a + b; },
101
- from: (target) => {
102
- let prototype = Object.getPrototypeOf(target);
103
- return prototype.spoofNumber;
104
- }
105
- },
106
- { for: "When a method is spoofed using a .plus provided by a function call, the spoof is used.", /* good */
107
- of: "spoofNumber",
108
- plus: this.supplySingleElementSpoofArray(),
109
- in: [ 12, 12 ], out: 32
110
- },
111
-
112
- { for: "When a method is spoofed before a non-spoofing .plus of false, the spoof is used.", /* good */
113
- of: "spoofNumber",
114
- plus: [ { of: "spoofNumber", as: 628 } ],
115
- in: [ 12, 12 ], out: 628
116
- },
117
- { for: "When a method is called with .plus of false, no spoofing is performed.", /* good */
118
- of: "spoofNumber",
119
- plus: false,
120
- in: [ 12, 12 ], out: 24
121
- },
122
-
123
- { for: "When a method is spoofed before a non-spoofing .plus of { }, the spoof is used.", /* good */
124
- of: "spoofNumber",
125
- plus: [ { of: "spoofNumber", as: 645 } ],
126
- in: [ 12, 12 ], out: 645
127
- },
128
- { for: "When a method is called with .plus of { }, no spoofing is performed.", /* good */
129
- of: "spoofNumber",
130
- plus: { },
131
- in: [ 12, 12 ], out: 24
132
- },
133
-
134
- { on: ObjectComposer, with: [] },
135
- { for: "When a method is spoofed to return a deep object that " +
136
- "is invoked internally, the spoofed deep object is used." /* good */,
137
- plus: [ { of: "supplySomeObject", as: [ { of: "outer.inner.callable", as: 18 } ] } ],
138
- of: "enact",
139
- in: [ ["outer", "inner" ], "callable" ],
140
- out: 18
141
- },
142
- { for: "When a method is spoofed to return a branched deep object " +
143
- "that is invoked internally, both branches are used.", /* good */
144
- plus: [ { of: "supplySomeObject",
145
- as: [
146
- { of: "outer.inner.callableOne", as: 16 },
147
- { of: "outer.inner.callableTwo", as: 20 }
148
- ] }
149
- ],
150
- of: "doubleEnact",
151
- in: [ [ "outer", "inner" ], "callableOne", [ "outer", "inner" ], "callableTwo" ],
152
- out: [ 16, 20 ]
153
- },
154
-
155
- { on: PolySpoofableOuter, with: [] },
156
- { for: "When nothing is spoofed, the original ops and args are used.", /* good */
157
- of: "combinedNumbers",
158
- in: [ { supplyA: () => { return 4; }, supplyB: () => { return 2; } } ],
159
- out: 36 /* (4 + 2) ^^ (4 - 2) = 6 ^^ 2 */
160
- },
161
- { for: "When class methods only are spoofed, the spoofed methods are used.", /* good */
162
- of: "combinedNumbers",
163
- plus: [ { on: PolySpoofableInner,
164
- as: [ { of: "addOrTimes", as: (numbers) => { return numbers.supplyA() * numbers.supplyB(); } },
165
- { of: "minusOrOver", as: (numbers) => { return numbers.supplyA() / numbers.supplyB(); } }
166
- ]
167
- }
168
- ],
169
- in: [ { supplyA: () => { return 6; }, supplyB: () => { return 2; } } ],
170
- out: 1728 /* (6 * 2) ^^ (6 / 2) */
171
- },
172
- { for: "When methods of two classes are spoofed, the spoofs of both are used.", /* good */
173
- of: "combinedNumbers",
174
- plus: [ { on: PolySpoofableOuter,
175
- of: "combiner",
176
- as: (first, second) => {
177
- let netLog = Math.log(second) / Math.log(first);
178
- return Number(netLog.toString().slice(0, 4));
179
- }
180
- },
181
- { on: PolySpoofableInner,
182
- as: [ { of: "addOrTimes", as: (numbers) => { return 2; } },
183
- { of: "minusOrOver", as: (numbers) => { return 8; } }
184
- ]
185
- }
186
- ],
187
- in: [ { supplyA: () => { return 7; }, supplyB: () => { return 4; } } ],
188
- out: 3 /* log base 2 of 8 */
189
- },
190
-
191
- { on: ConditionalThrowTarget, of: "returnArgOrThrow", with: [ ] },
192
- { for: "When arg is provided, returns the arg.", /* good */
193
- in: [ "some-arg" ], out: "some-arg" },
194
- { for: "When no arg is provided, but .and contains \"throws\", throws Error with expected message.", /* good */
195
- and: "throws something",
196
- in: [ ], out: new Error("No arg provided.") },
197
- { for: "When no arg is provided, but .and contains \"throw\", throws Error with expected message.", /* good */
198
- and: "something throw",
199
- in: [ ], out: new Error("No arg provided.") },
200
-
201
- { on: MixedContents, with: [ ] },
202
- { for: "When .plus contains an { of, as }, .as is used for .of on the target.", /* good */
203
- of: "getInstanceValueOf",
204
- in: [ "first" ],
205
- plus: [ { of: "first", as: 25 } ],
206
- out: 25 },
207
- { for: "When .plus is an empty array, original target property values are used.", /* good */
208
- of: "getInstanceProduct",
209
- in: [ ],
210
- plus: [ ],
211
- out: 6 },
212
- { for: "When .plus sets several properties, those property values are used.", /* good */
213
- of: "getInstanceProduct",
214
- in: [ ],
215
- plus: [ { of: "first", as: 12 }, { of: "second", as: 6 }, { of: "third", as: { three: 7 } } ],
216
- out: 504 },
217
- { for: "When .plus spoofs a static property, .as is used for .of on the topic class.", /* good */
218
- of: "getStaticValueOf",
219
- in: [ "fourth" ],
220
- plus: [ { of: "fourth", as: 18 } ],
221
- out: 18 },
222
- { for: "When .plus is an empty array in a static test, original topic-class property values are used.", /* good */
223
- of: "getStaticProduct",
224
- in: [ ],
225
- plus: [ ],
226
- out: 20 },
227
- { for: "When .plus spoofs several static properties, those topic-class property values are used.", /* good */
228
- of: "getStaticProduct",
229
- in: [ ],
230
- plus: [ { of: "fourth", as: 7 }, { of: "fifth", as: "12" } ],
231
- out: 84 },
232
-
233
- { on: MixedContents, with: [ ] },
234
- { for: "When .plus poly-spoofs several properties, those property values are used.", /* good */
235
- of: "getInstanceProduct",
236
- in: [ ],
237
- plus: [ {
238
- on: MixedContents,
239
- as: [
240
- { of: "first", as: 37 },
241
- { of: "second", as: 5 },
242
- // Double-nested acts the same as single-nested or unnested.
243
- { of: "third", as: { three: 4 } } ]
244
- }
245
- ],
246
- out: 740 },
247
- { for: "When .plus poly-spoofs several static properties, those topic-class property values are used.", /* good */
248
- of: "getStaticProduct",
249
- in: [ ],
250
- plus: [ {
251
- as: [
252
- { of: "fourth", as: 3 },
253
- { of: "fifth", as: "25" } ]
254
- }
255
- ],
256
- out: 75 },
257
-
258
- { on: Returner, with: [ ] },
259
- { for: "When a class is used in args, this test result displays its name only wherever used.", /* good */
260
- of: "returnArg", in: [ MixedContents ], out: MixedContents },
261
- { for: "When a class is used in a Map in args, only its name is used in this test result.", /* good */
262
- of: "returnArg", in: [ new Map([ [ Spoofable, 2 ], [ MixedContents, 3 ] ]) ],
263
- out: new Map([ [ Spoofable, 2 ], [ MixedContents, 3 ] ]) },
264
- { for: "When a class is used in an object in args, only its name is used in this test result.", /* good */
265
- of: "returnArg", in: [ { moment: Moment, spoofable: Spoofable } ],
266
- out: { moment: Moment, spoofable: Spoofable } },
267
-
268
- { on: MutationTarget, with: [ new Map([ [ "1", "A" ], [ "2", "B" ] ]), [ 8, 9, 10 ] ], and: "nospoof" },
269
- { for: "When the tested method mutates its args, the args it addresses are mutated.", /* good */
270
- of: "mutateArgs",
271
- in: [ [ 7, 8, 9 ], { retainable: 12, changes: 30 } ],
272
- out: { array: [ 7, 8, 9, 10 ], tuple: { retainable: 12, changes: 40 } },
273
- from: [ ] },
274
- { for: "When mutated args are not collapsed forward, .in values have only been mutated once.", /* good */
275
- in: [ [ 7, 8, 9 ], { retainable: 12, changes: 30 } ],
276
- out: [ [ 7, 8, 9, 10 ], { retainable: 12, changes: 40 } ],
277
- from: (target, test) => { return test.in; } },
278
-
279
- { for: "When the tested method mutates the constructor args, the args it addresses are mutated.", /* good */
280
- of: "mutateInitors",
281
- in: [ ],
282
- out: { map: new Map([ [ "1", "A" ], [ "2", "B" ], [ "3", "C" ] ]), array: [ 9, 10 ] },
283
- from: [ ] },
284
- { for: "When constructor args are not collapsed forward, local .with values have only been mutated once.", /* good */
285
- of: "mutateInitors",
286
- with: [ new Map([ [ "1", "A" ], [ "2", "B" ] ]), [ 8, 9, 10 ] ],
287
- in: [ ],
288
- out: [ new Map([ [ "1", "A" ], [ "2", "B" ], [ "3", "C" ] ]), [ 9, 10 ] ],
289
- from: (target, test) => { return test.with; } },
290
-
291
- { on: MutationTarget,
292
- with: [ ], of: "replaceArg", and: "nospoof",
293
- in: [ [ () => { return "first"; } ], 0, () => { return "second"; } ] },
294
- { for: "When called, replaces the first arg and adds text of original in output.", /* good */
295
- out: [ () => { return "second"; }, "() => { return \"first\"; }" ] },
296
- { for: "When .in args are not collapsed forward, local .in args have only been mutated once.", /* good */
297
- in: [ [ () => { return "first"; } ], 0, () => { return "second"; } ],
298
- out: [ [ () => { return "second"; }, "() => { return \"first\"; }" ], 0, () => { return "second"; } ],
299
- from: (target, test) => { return test.in; } },
300
-
301
- /* Tests of sigils in .of, .plus, and .from. */
302
- { on: TestableTarget, with: [ ] },
303
- { for: "When .of names a static property with a leading \".\", the actual is that property's value.", /* good */
304
- of: ".staticValueProp", // Tested condition.
305
- in: [ ], out: 3 },
306
- { for: "When .of names an instance property with a leading \".\", the actual is that property's value.", /* good */
307
- of: ".accessorProp", // Tested condition.
308
- in: [ ], out: "2nd" },
309
- { for: "When .of names a static property with a trailing \":\", the actual is that property's value.", /* good */
310
- of: "staticAccessorProp:", // Tested condition.
311
- in: [ ], out: "4th" },
312
- { for: "When .of names an instance property with a trailing \".\", the actual is that property's value.", /* good */
313
- of: "valueProp:", // Tested condition.
314
- in: [ ], out: 1 },
315
- { for: "When .of names a static method with a trailing \"()\", the actual is the method's return value.", /* good */
316
- of: "staticMethod()", // Tested condition.
317
- in: [ ], out: "static" },
318
- { for: "When .of names an instance method with a trailing \"()\", the actual is the method's return value.", /* good */
319
- of: "instanceMethod()", // Tested condition.
320
- in: [ 24, 73 ], out: "instance-method-24-73" },
321
-
322
- { on: TestableTarget, with: [ ] },
323
- { for: "When the name of a static property to spoof has a leading \".\", that property is spoofed.", /* good */
324
- of: "staticValueProp",
325
- plus: [ { of: ".staticValueProp", as: 37 } ], // Tested condition.
326
- in: [ ], out: 37 },
327
- { for: "When the name of an instance property to spoof has a leading \".\", that property is spoofed.", /* good */
328
- of: "valueProp",
329
- plus: [ { of: ".valueProp", as: 49 } ], // Tested condition.
330
- in: [ ], out: 49 },
331
- { for: "When the name of a static property to spoof has a trailing \":\", that property is spoofed.", /* good */
332
- of: "staticAccessorProp",
333
- plus: [ { of: "staticAccessorProp:", as: "28" } ], // Tested condition.
334
- in: [ ], out: "28" },
335
- { for: "When the name of an instance property to spoof has a trailing \":\", that property is spoofed.", /* good */
336
- of: "accessorProp",
337
- plus: [ { of: "accessorProp:", as: "30" } ], // Tested condition.
338
- in: [ ], out: "30" },
339
- { for: "When the name of a static method to spoof has a trailing \"()\", that method is spoofed.", /* good */
340
- of: "staticMethod",
341
- plus: [ { of: "staticMethod()", as: 27 } ], // Tested condition.
342
- in: [ ], out: 27 },
343
- { for: "When the name of an instance method to spoof has a trailing \"()\", that method is spoofed.", /* good */
344
- of: "instanceMethod",
345
- plus: [ { of: "instanceMethod()", as: 15 } ], // Tested condition.
346
- in: [ ], out: 15 },
347
-
348
- { on: TestableTarget, with: [ ] },
349
- { for: "When .from is a static property with a leading \".\" in a static test, its value is used as the actual.", /* good */
350
- of: "staticMethod", // Static call but instance prop.
351
- in: [ ], out: "4th",
352
- from: ".staticAccessorProp" // Tested condition.
353
- },
354
- { for: "When .from is an instance property with a leading \".\" in an instance test, its value is used as the actual.", /* good */
355
- of: "instanceMethod", // Instance call but static prop.
356
- in: [ ], out: "2nd",
357
- from: ".accessorProp" // Tested condition.
358
- },
359
-
360
- { for: "When .from is a static property with a trailing \":\" in a static test, its value is used as the actual.", /* good */
361
- of: "staticMethod",
362
- in: [ ], out: 3,
363
- from: "staticValueProp:" // Tested condition.
364
- },
365
- { for: "When .from is an instance property with a trailing \":\" in an instance test, its value is used as the actual.", /* good */
366
- of: "instanceMethod",
367
- in: [ ], out: 1,
368
- from: "valueProp:" // Tested condition.
369
- },
370
-
371
- { for: "When .from is a static property with a leading \".\" in an instance test, its value is used as the actual.", /* good */
372
- of: "instanceMethod", // Instance call but static prop.
373
- in: [ ], out: "4th",
374
- from: ".staticAccessorProp" // Tested condition.
375
- },
376
- { for: "When .from is an instance property with a leading \".\" in a static test, the actual's value is undefined.", /* good */
377
- of: "staticMethod", // Static call but instance prop.
378
- in: [ ], out: this.undef,
379
- from: ".accessorProp" // Tested condition.
380
- },
381
-
382
- { for: "When .from is a static property with a trailing \":\" in an instance test, its value is used as the actual.", /* good */
383
- of: "instanceMethod", // Instance call but static prop.
384
- in: [ ], out: 3,
385
- from: "staticValueProp:" // Tested condition.
386
- },
387
- { for: "When .from is an instance property with a trailing \":\" in a static test, the actual's value is undefined.", /* good */
388
- of: "staticMethod", // Static call but instance prop.
389
- in: [ ], out: this.undef,
390
- from: "valueProp:" // Tested condition.
391
- },
392
-
393
- { for: "When .from is a static property in an instance test, its value is used as the actual.", /* good */
394
- of: "instanceMethod", // Instance call but static prop.
395
- in: [ ], out: "4th",
396
- from: "staticAccessorProp" // Tested condition.
397
- },
398
- { for: "When .from is an instance property in a static test, the actual's value is undefined.", /* good */
399
- of: "staticMethod", // Static call but instance prop.
400
- in: [ ], out: this.undef,
401
- from: "accessorProp" // Tested condition.
402
- },
403
-
404
- /* Tests of .do and .undo. All ordered pairs of tests must be preserved. */
405
- { on: TestableTarget, with: [ ], of: "staticAccessorProp" },
406
- { for: "When a test has .do .early but no .undo, the changes to test.on persist in the next test.", /* good */
407
- do: {
408
- early: (test) => { test.on.staticAccessorProp = 64; }
409
- },
410
- in: [ ],
411
- out: 64 },
412
- { for: "When the last test had a .do .early but no .undo, the changes to test.on still exist in this test.", /* good */
413
- do: [ ], // .do must be wiped out, since otherwise it collapses forward.
414
- undo: (test) => { test.on.staticAccessorProp = "4th"; },
415
- in: [ ],
416
- out: 64 },
417
-
418
- { for: "When a test has .do .early and .undo, the changes to test.on are lost in the next test.", /* good */
419
- do: {
420
- early: (test) => { test.on.staticAccessorProp = 33; }
421
- },
422
- undo: (test) => { test.on.staticAccessorProp = "4th"; },
423
- in: [ ],
424
- out: 33 },
425
- { for: "When the last test had a .do .early and .undo, the changes to test.on are lost in this test.", /* good */
426
- do: [ ], // .do must be wiped out, since otherwise it collapses forward.
427
- undo: [ ], // .undo must be wiped out, since otherwise it collapses forward.
428
- in: [ ],
429
- out: "4th" },
430
-
431
- { on: TestableTarget, with: [ ], of: "accessorProp" },
432
- { for: "When a test has .do .late but no .undo, the changes on test.target are lost in the next test.", /* good */
433
- do: {
434
- late: (test) => { test.target.accessorProp = 79; }
435
- },
436
- in: [ ],
437
- out: 79 },
438
- { for: "When the last test had .do .late but no .undo, changes on test.target are lost in this test.", /* good */
439
- do: [ ], // .do must be wiped out, since otherwise it collapses forward.
440
- undo: (test) => { test.target.accessorProp = "2nd"; },
441
- in: [ ],
442
- out: "2nd" },
443
-
444
- { on: TestableTarget, with: [ ], of: "staticAccessorProp" },
445
- { for: "When a test has .do .late and an .undo, the changes test.on are lost in the next test.", /* good */
446
- do: {
447
- late: (test) => { test.on.staticAccessorProp = 79; }
448
- },
449
- undo: (test) => { test.on.staticAccessorProp = "4th"; },
450
- in: [ ],
451
- out: 79 },
452
- { for: "When the last test had .do .late and an .undo, changes on test.on are lost in this test.", /* good */
453
- do: [ ], // .do must be wiped out, since otherwise it collapses forward.
454
- undo: [ ], // .undo must be wiped out, since otherwise it collapses forward.
455
- in: [ ],
456
- out: "4th" },
457
-
458
- { on: TestableTarget, with: [ ], of: "constructor" },
459
- { for: "When a test has .do .early, .do .late, and .undo, all the changes to test.on and test.target are wiped out in the next test.", /* good */
460
- do: {
461
- early: (test) => { test.on.staticAccessorProp = 47; },
462
- late: (test) => { test.target.accessorProp = 95; }
463
- },
464
- undo: (test) => {
465
- test.on.staticAccessorProp = "4th";
466
- test.target.accessorProp = "2nd";
467
- },
468
- in: [ ],
469
- out: true,
470
- from: (target, test) => {
471
- let areChanged = TestableTarget.staticAccessorProp === 47
472
- && test.target.accessorProp === 95;
473
-
474
- return areChanged;
475
- },
476
- },
477
- { for: "When the last test had .do .early, .do .late, and .undo, none of the changes exist in this test.", /* good */
478
- do: [ ], // .do must be wiped out, since otherwise it collapses forward.
479
- undo: [ ], // .undo must be wiped out, since otherwise it collapses forward.
480
- in: [ ],
481
- out: false,
482
- from: (target, test) => {
483
- let areChanged = TestableTarget.staticAccessorProp === 47
484
- || test.target.accessorProp === 95;
485
-
486
- return areChanged;
487
- },
488
- },
489
-
490
- /* Tests of .just / .only. All ordered pairs of tests must be preserved. */
491
- { on: MixedContents, with: [ ], of: "getInstanceValueOf" },
492
- { for: "When a test has a .just object following it, no extra test is introduced after it.", /* good */
493
- in: [ "second" ], out: "2" },
494
- { just: true, in: [ "third" ] },
495
- { for: "When a test has a .just object before it, it includes the \"just\" isolated changes.", /* good */
496
- // .in is set in the .just object.
497
- out: { three: 3 }
498
- },
499
-
500
- { for: "When a test has an .only object following it, no extra test is introduced after it.", /* good */
501
- in: [ "first" ], out: 1 },
502
- { only: true, plus: [ { of: "getInstanceValueOf", as: 833 } ] },
503
- { for: "When a test has an .only object before it, it includes the \"only\" isolated changes.", /* good */
504
- in: [ "third" ], out: 833 // Spoofed value is set in the .only object.
505
- },
506
-
507
- ];
508
-
509
- // endregion Tests
510
-
511
- }