orc-scripts 1.2.0-pre.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/LICENSE +19 -0
- package/README.md +76 -0
- package/babel.js +1 -0
- package/eslint.js +1 -0
- package/jest.js +1 -0
- package/package.json +164 -0
- package/prettier.js +1 -0
- package/src/__mocks__/fileMock.js +1 -0
- package/src/config/babel-preset.js +4 -0
- package/src/config/babel-transform.js +4 -0
- package/src/config/babel-whitelist.json +1 -0
- package/src/config/babelrc.js +38 -0
- package/src/config/eslintrc.js +15 -0
- package/src/config/jest-resolver.js +35 -0
- package/src/config/jest.config.js +45 -0
- package/src/config/jestSetupFiles.js +4 -0
- package/src/config/prettier.config.js +9 -0
- package/src/config/setAssetPath.js +1 -0
- package/src/config/unexpected-form.js +317 -0
- package/src/config/unexpected-form.test.js +2397 -0
- package/src/config/unexpected-module.js +112 -0
- package/src/config/unexpected-module.test.js +1106 -0
- package/src/config/unexpected-styles.js +44 -0
- package/src/config/unexpected-styles.test.js +118 -0
- package/src/config/unexpected.js +117 -0
- package/src/config/unexpected.test.js +393 -0
- package/src/config/webpack.config.js +103 -0
- package/src/index.js +19 -0
- package/src/run-script.js +99 -0
- package/src/scripts/build/cli.js +43 -0
- package/src/scripts/build/index.js +9 -0
- package/src/scripts/build/web.js +24 -0
- package/src/scripts/buildDep.js +122 -0
- package/src/scripts/buildIconsSheet.js +50 -0
- package/src/scripts/clean.js +8 -0
- package/src/scripts/extract-messages.js +22 -0
- package/src/scripts/generateApi.js +152 -0
- package/src/scripts/getDist.js +20 -0
- package/src/scripts/mergeTranslations.js +32 -0
- package/src/scripts/prep.js +28 -0
- package/src/scripts/start.js +45 -0
- package/src/scripts/tag.js +76 -0
- package/src/scripts/test.js +26 -0
- package/src/scripts/validateTranslations.js +72 -0
- package/src/utils.js +95 -0
- package/src/utils.test.js +93 -0
- package/webpack.js +1 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
name: "unexpected-module",
|
|
3
|
+
installInto: function (expect) {
|
|
4
|
+
expect
|
|
5
|
+
.addAssertion("<object> to be a component", function (expect, subject) {
|
|
6
|
+
return expect(
|
|
7
|
+
subject,
|
|
8
|
+
expect.it("to have property", "$$typeof", Symbol.for("react.memo")).or("to be a function"),
|
|
9
|
+
);
|
|
10
|
+
})
|
|
11
|
+
.addAssertion("<any> to be a component", function (expect) {
|
|
12
|
+
return expect.fail();
|
|
13
|
+
})
|
|
14
|
+
.addAssertion("<object> to be a subpage", function (expect, subject) {
|
|
15
|
+
const pattern = {
|
|
16
|
+
component: expect.it("to be a component"),
|
|
17
|
+
};
|
|
18
|
+
if (subject.toolStateSelector) {
|
|
19
|
+
pattern.toolStateSelector = expect.it("to be a function");
|
|
20
|
+
}
|
|
21
|
+
if (subject.toolFuncSelector) {
|
|
22
|
+
pattern.toolFuncSelector = expect.it("to be a function");
|
|
23
|
+
}
|
|
24
|
+
expect(subject, "to exhaustively satisfy", pattern);
|
|
25
|
+
})
|
|
26
|
+
.addAssertion("<object> to be a segment", function (expect, subject) {
|
|
27
|
+
const pattern = {
|
|
28
|
+
label: expect.it("to be a label"),
|
|
29
|
+
component: expect.it("to be a component"),
|
|
30
|
+
};
|
|
31
|
+
if (subject.dataPath) {
|
|
32
|
+
pattern.label = expect.it("to be an object").and("to be a label");
|
|
33
|
+
pattern.dataPath = expect
|
|
34
|
+
.it("to be an array")
|
|
35
|
+
.and("to have items satisfying", expect.it("to be a string").or("to be a number"));
|
|
36
|
+
if (subject.dataIdParam) {
|
|
37
|
+
pattern.dataIdParam = expect.it("to match", /^\w+$/);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (subject.pages) {
|
|
41
|
+
pattern.pages = expect.it("to be a page list");
|
|
42
|
+
}
|
|
43
|
+
if (subject.subpages) {
|
|
44
|
+
pattern.subpages = expect.it("to be a subpage list");
|
|
45
|
+
}
|
|
46
|
+
expect(subject, "to exhaustively satisfy", pattern);
|
|
47
|
+
})
|
|
48
|
+
.addAssertion("<object> to be a page", function (expect, subject) {
|
|
49
|
+
expect.errorMode = "bubble";
|
|
50
|
+
if (subject.dataPath) {
|
|
51
|
+
const pattern = {
|
|
52
|
+
label: expect.it("to be an object").and("to be a label"),
|
|
53
|
+
dataPath: expect
|
|
54
|
+
.it("to be an array")
|
|
55
|
+
.and("to have items satisfying", expect.it("to be a string").or("to be a number")),
|
|
56
|
+
};
|
|
57
|
+
if (subject.dataIdParam) {
|
|
58
|
+
pattern.dataIdParam = expect.it("to match", /^\w+$/);
|
|
59
|
+
}
|
|
60
|
+
expect(subject, "to satisfy", pattern);
|
|
61
|
+
} else {
|
|
62
|
+
expect(subject, "to satisfy", {
|
|
63
|
+
label: expect.it("to be a label"),
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
if (subject.component) {
|
|
67
|
+
expect(subject, "to satisfy", {
|
|
68
|
+
component: expect.it("to be a component"),
|
|
69
|
+
});
|
|
70
|
+
if (subject.pages) {
|
|
71
|
+
expect(subject, "to satisfy", {
|
|
72
|
+
pages: expect.it("to be a page list"),
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
if (subject.subpages) {
|
|
76
|
+
expect(subject, "to satisfy", {
|
|
77
|
+
subpages: expect.it("to be a subpage list"),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
expect(subject, "not to have key", "segments");
|
|
81
|
+
} else {
|
|
82
|
+
expect(subject, "to satisfy", {
|
|
83
|
+
segments: expect.it("to be a segment list"),
|
|
84
|
+
});
|
|
85
|
+
expect(subject, "not to have key", "pages");
|
|
86
|
+
expect(subject, "not to have key", "subpages");
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
.addAssertion("<object> to be a subpage list", function (expect, subject) {
|
|
90
|
+
expect(subject, "to have keys satisfying", "to start with", "/");
|
|
91
|
+
expect(subject, "to have values satisfying", "to be a subpage");
|
|
92
|
+
})
|
|
93
|
+
.addAssertion("<object> to be a segment list", function (expect, subject) {
|
|
94
|
+
expect(subject, "to have keys satisfying", "to start with", "/");
|
|
95
|
+
expect(subject, "to have values satisfying", "to be a segment");
|
|
96
|
+
})
|
|
97
|
+
.addAssertion("<object> to be a page list", function (expect, subject) {
|
|
98
|
+
expect(subject, "to have keys satisfying", "to start with", "/");
|
|
99
|
+
expect(subject, "to have values satisfying", "to be a page");
|
|
100
|
+
})
|
|
101
|
+
.addAssertion("<object> to be a module structure", function (expect, subject) {
|
|
102
|
+
expect(subject, "to have keys satisfying", "not to start with", "/");
|
|
103
|
+
expect(
|
|
104
|
+
subject,
|
|
105
|
+
"to have values satisfying",
|
|
106
|
+
expect.it("to be a page").and("to satisfy", {
|
|
107
|
+
icon: expect.it("to be a string"),
|
|
108
|
+
}),
|
|
109
|
+
);
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
};
|