risei 2.0.0 → 3.0.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/README.md +123 -220
- package/package.json +2 -2
- package/system/ATestReporter.js +26 -26
- package/system/ClassTestGroup.js +8 -8
- package/system/LocalCaller.js +2 -2
- package/system/MethodSpoofer.js +2 -2
- package/system/MethodTestGroup.js +8 -8
- package/system/Moment.js +29 -29
- package/system/NameAnalyzer.js +26 -26
- package/system/PropertySpoofer.js +1 -1
- package/system/SpoofDef.js +0 -5
- package/system/TestDef.js +14 -13
- package/system/TestFrame.js +8 -10
- package/system/TestGroup.js +25 -25
- package/system/TestRunner.js +8 -6
- package/system/TestStages.js +66 -10
- package/system/TestSummary.js +37 -37
- package/system/TypeAnalyzer.js +79 -26
- package/Read-me reduced.md +0 -294
- package/Read-me redux.md +0 -581
- package/system/ChosenTestFinder.js +0 -31
- package/system/Risei.js +0 -118
- package/test-target-objects/ConditionalThrowTarget.js +0 -11
- package/test-target-objects/Counter.js +0 -46
- package/test-target-objects/DomTarget.js +0 -37
- package/test-target-objects/InterSpoofer.js +0 -230
- package/test-target-objects/MixedContents.js +0 -33
- package/test-target-objects/MutationTarget.js +0 -37
- package/test-target-objects/ObjectComposer.js +0 -34
- package/test-target-objects/PolySpoofableInner.js +0 -29
- package/test-target-objects/PolySpoofableOuter.js +0 -52
- package/test-target-objects/PropertiesTarget.js +0 -98
- package/test-target-objects/Returner.js +0 -7
- package/test-target-objects/Searcher.js +0 -25
- package/test-target-objects/Sorter.js +0 -91
- package/test-target-objects/Spoofable.js +0 -36
- package/test-target-objects/StateTarget.js +0 -34
- package/test-target-objects/StaticTarget.js +0 -17
- package/test-target-objects/TestableTarget.js +0 -57
- package/trial-tests/SelfTests.outward-rt.js +0 -511
- package/trial-tests/TopicTests.outward-rt.js +0 -313
- package/usage-examples/Gold-bar-example.png +0 -0
- package/usage-examples/Output-example.png +0 -0
- package/usage-examples/Summary-example.png +0 -0
- package/usage-examples/Syntax-example.png +0 -0
- package/usage-examples/Title-example.png +0 -0
- package/xternal-tests/ASpoofingFixture.tests.js +0 -242
- package/xternal-tests/MethodSpoofer.tests.js +0 -130
- package/xternal-tests/SpoofDef.tests.js +0 -91
- package/xternal-tests/TotalComparer.tests.js +0 -1055
- package/xternal-tests/package.json +0 -7
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
/**/
|
|
2
|
-
|
|
3
|
-
import MethodSpoofer from "../system/MethodSpoofer.js";
|
|
4
|
-
import Spoofable from "../test-target-objects/Spoofable.js";
|
|
5
|
-
import TotalComparer from "../system/TotalComparer.js";
|
|
6
|
-
|
|
7
|
-
import { expect } from "chai";
|
|
8
|
-
|
|
9
|
-
describe("MethodSpoofer", () => {
|
|
10
|
-
let comparer = new TotalComparer();
|
|
11
|
-
|
|
12
|
-
describe("spoof()", () => {
|
|
13
|
-
describe("Direct tests: Definition of spoofed method is compared.", () => {
|
|
14
|
-
it("Should set class method to be empty when given args which define that.", /* good */ () => {
|
|
15
|
-
let target = new MethodSpoofer();
|
|
16
|
-
let definition = { of: "spoofNumber" };
|
|
17
|
-
let arg = { on: Spoofable, plus: [ definition ] };
|
|
18
|
-
|
|
19
|
-
target.spoof(arg);
|
|
20
|
-
|
|
21
|
-
let actual = Spoofable.prototype.spoofNumber;
|
|
22
|
-
|
|
23
|
-
target.unspoof();
|
|
24
|
-
|
|
25
|
-
let comparison = comparer.compare(actual, () => { });
|
|
26
|
-
expect(comparison).to.be.true;
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it("Should set class method to a known nonce function when given that nonce as an arg.", /* good */ () => {
|
|
30
|
-
let target = new MethodSpoofer();
|
|
31
|
-
let definition = { of: "spoofNumber", as: (a, b) => { return b - a; } };
|
|
32
|
-
let arg = { on: Spoofable, plus: [ definition ] };
|
|
33
|
-
|
|
34
|
-
target.spoof(arg);
|
|
35
|
-
|
|
36
|
-
let actual = Spoofable.prototype.spoofNumber;
|
|
37
|
-
|
|
38
|
-
target.unspoof();
|
|
39
|
-
|
|
40
|
-
let comparison = comparer.compare(actual, (a, b) => { return b - a; });
|
|
41
|
-
expect(comparison).to.be.true;
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it("Should set class method to a simple function returning a named parameter when given args which define that.", /* good */ () => {
|
|
45
|
-
let target = new MethodSpoofer();
|
|
46
|
-
let definition = { of: "spoofNumber" , as: 32 };
|
|
47
|
-
let arg = { on: Spoofable, plus: [ definition ] };
|
|
48
|
-
|
|
49
|
-
target.spoof(arg);
|
|
50
|
-
|
|
51
|
-
let actual = Spoofable.prototype.spoofNumber;
|
|
52
|
-
|
|
53
|
-
target.unspoof();
|
|
54
|
-
|
|
55
|
-
let comparison = comparer.compare(actual, () => { return spoofOutput; });
|
|
56
|
-
expect(comparison).to.be.true;
|
|
57
|
-
});
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
describe("Indirect tests: Result of calling spoofed method is compared.", () => {
|
|
61
|
-
it("Should set class method to return a known value when given args which define that.", /* good */ () => {
|
|
62
|
-
let target = new MethodSpoofer();
|
|
63
|
-
let definition = { of: "spoofNumber", as: 17 };
|
|
64
|
-
let arg = { on: Spoofable, plus: [ definition ] };
|
|
65
|
-
|
|
66
|
-
target.spoof(arg);
|
|
67
|
-
|
|
68
|
-
let spoofed = Spoofable.prototype.spoofNumber;
|
|
69
|
-
let actual = spoofed();
|
|
70
|
-
|
|
71
|
-
target.unspoof();
|
|
72
|
-
|
|
73
|
-
let comparison = comparer.compare(actual, 17);
|
|
74
|
-
expect(comparison).to.be.true;
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it("Should set class method to return a known string when given args which define that.", /* good */ () => {
|
|
78
|
-
let target = new MethodSpoofer();
|
|
79
|
-
let definition = { of: "spoofText", as: "return-text" };
|
|
80
|
-
let arg = { on: Spoofable, plus: [ definition ] };
|
|
81
|
-
|
|
82
|
-
target.spoof(arg);
|
|
83
|
-
|
|
84
|
-
let spoofed = Spoofable.prototype.spoofText;
|
|
85
|
-
let actual = spoofed();
|
|
86
|
-
|
|
87
|
-
target.unspoof();
|
|
88
|
-
|
|
89
|
-
let comparison = comparer.compare(actual, "return-text");
|
|
90
|
-
expect(comparison).to.be.true;
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it("Should set class method to return a known object when given args which define that.", /* good */ () => {
|
|
94
|
-
let target = new MethodSpoofer();
|
|
95
|
-
let definition = { of: "spoofText", as: { first: "one", second: "two" } };
|
|
96
|
-
let arg = { on: Spoofable, plus: [ definition ] };
|
|
97
|
-
|
|
98
|
-
target.spoof(arg);
|
|
99
|
-
|
|
100
|
-
let spoofed = Spoofable.prototype.spoofText;
|
|
101
|
-
let actual = spoofed();
|
|
102
|
-
|
|
103
|
-
target.unspoof();
|
|
104
|
-
|
|
105
|
-
let comparison = comparer.compare(actual, { first: "one", second: "two" });
|
|
106
|
-
expect(comparison).to.be.true;
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
it("Should set class method to return a deep spoofed object when given args which define that.", /* good */ () => {
|
|
110
|
-
let target = new MethodSpoofer();
|
|
111
|
-
let definition = { of: "spoofNumber", as: [ { of: "these.those.the.other", as: 76 } ] };
|
|
112
|
-
let arg = { on: Spoofable, plus: [ definition ] };
|
|
113
|
-
|
|
114
|
-
target.spoof(arg);
|
|
115
|
-
|
|
116
|
-
let spoofed = Spoofable.prototype.spoofNumber;
|
|
117
|
-
let actual = spoofed();
|
|
118
|
-
|
|
119
|
-
target.unspoof();
|
|
120
|
-
|
|
121
|
-
let expected = { these: { those: { the: { other: () => { return spoofOutput; } } } } };
|
|
122
|
-
|
|
123
|
-
let comparison = comparer.compare(actual, expected);
|
|
124
|
-
expect(comparison).to.be.true;
|
|
125
|
-
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**/
|
|
2
|
-
|
|
3
|
-
import SpoofDef from "../system/SpoofDef.js";
|
|
4
|
-
import { expect } from "chai";
|
|
5
|
-
|
|
6
|
-
describe("SpoofDef", () => {
|
|
7
|
-
/* Some cases here are effectively impossible to test directly in self-tests, at least
|
|
8
|
-
without complicated workarounds, because of how SpoofDef is used by Risei tests. */
|
|
9
|
-
|
|
10
|
-
describe("isNotASpoof()", () => {
|
|
11
|
-
it("Should return true when arg is undefined.", /* good */ () => {
|
|
12
|
-
let nonce = undefined;
|
|
13
|
-
|
|
14
|
-
let actual = SpoofDef.isNotASpoof(nonce);
|
|
15
|
-
|
|
16
|
-
expect(actual).to.be.true;
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it("Should return true when arg is null.", /* good */ () => {
|
|
20
|
-
let nonce = null;
|
|
21
|
-
|
|
22
|
-
let actual = SpoofDef.isNotASpoof(nonce);
|
|
23
|
-
|
|
24
|
-
expect(actual).to.be.true;
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it("Should return true when arg is a string.", /* good */ () => {
|
|
28
|
-
let nonce = "text";
|
|
29
|
-
|
|
30
|
-
let actual = SpoofDef.isNotASpoof(nonce);
|
|
31
|
-
|
|
32
|
-
expect(actual).to.be.true;
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it("Should return true when arg is a value, such as a number.", /* good */ () => {
|
|
36
|
-
let nonce = 37;
|
|
37
|
-
|
|
38
|
-
let actual = SpoofDef.isNotASpoof(nonce);
|
|
39
|
-
|
|
40
|
-
expect(actual).to.be.true;
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it("Should return true when arg is a predefined JavaScript Object, such as a Map.", /* good */ () => {
|
|
44
|
-
let nonce = new Map();
|
|
45
|
-
|
|
46
|
-
let actual = SpoofDef.isNotASpoof(nonce);
|
|
47
|
-
|
|
48
|
-
expect(actual).to.be.true;
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it("Should return true when arg doesn't contain any SpoofDef properties.", /* good */ () => {
|
|
52
|
-
let nonce = { notOn: true, notOf: "true", notAs: "not-as" };
|
|
53
|
-
|
|
54
|
-
let actual = SpoofDef.isNotASpoof(nonce);
|
|
55
|
-
|
|
56
|
-
expect(actual).to.be.true;
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it("Should return false when arg contains .of.", /* good */ () => {
|
|
60
|
-
let nonce = { of: "some-method" };
|
|
61
|
-
|
|
62
|
-
let actual = SpoofDef.isNotASpoof(nonce);
|
|
63
|
-
|
|
64
|
-
expect(actual).to.be.false;
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it("Should return false when arg contains .as.", /* good */ () => {
|
|
68
|
-
let nonce = { as: "some-output" };
|
|
69
|
-
|
|
70
|
-
let actual = SpoofDef.isNotASpoof(nonce);
|
|
71
|
-
|
|
72
|
-
expect(actual).to.be.false;
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it("Should return false when arg contains .method.", /* good */ () => {
|
|
76
|
-
let nonce = { method: "some-method" };
|
|
77
|
-
|
|
78
|
-
let actual = SpoofDef.isNotASpoof(nonce);
|
|
79
|
-
|
|
80
|
-
expect(actual).to.be.false;
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it("Should return false when arg contains .output.", /* good */ () => {
|
|
84
|
-
let nonce = { output: "some-output" };
|
|
85
|
-
|
|
86
|
-
let actual = SpoofDef.isNotASpoof(nonce);
|
|
87
|
-
|
|
88
|
-
expect(actual).to.be.false;
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
});
|