jssm 5.35.4 → 5.42.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/.codeclimate.yml +22 -22
- package/.editorconfig +12 -12
- package/.eslintrc +20 -20
- package/.nycrc +6 -6
- package/.travis.yml +8 -8
- package/LICENSE.md +21 -21
- package/README.md +997 -993
- package/dist/es6/jssm-dot.d.ts +6 -6
- package/dist/es6/jssm-dot.js +1 -1
- package/dist/es6/jssm.d.ts +100 -100
- package/dist/es6/jssm.js +792 -792
- package/dist/es6/jssm_types.d.ts +151 -151
- package/dist/es6/jssm_types.js +1 -1
- package/dist/es6/jssm_util.d.ts +8 -8
- package/dist/es6/jssm_util.js +34 -34
- package/dist/es6/version.d.ts +2 -2
- package/dist/es6/version.js +2 -2
- package/dist/jssm.es5.cjs.js +1 -1
- package/dist/jssm.es5.iife.js +1 -0
- package/jest-spec.config.js +27 -27
- package/jest-stoch.config.js +27 -27
- package/jssm-dot.d.ts +6 -6
- package/jssm.d.ts +100 -100
- package/jssm_types.d.ts +151 -151
- package/jssm_util.d.ts +8 -8
- package/package.json +125 -122
- package/rollup.config.iife.js +44 -44
- package/rollup.config.js +44 -44
- package/src/demo/index.html +38 -38
- package/src/demo/style.css +1 -1
- package/src/ts/jssm-dot.peg +928 -874
- package/src/ts/jssm.ts +1120 -1120
- package/src/ts/jssm_types.ts +346 -346
- package/src/ts/jssm_util.ts +100 -100
- package/src/ts/tests/actions.spec.ts +167 -167
- package/src/ts/tests/arrange.spec.ts +72 -72
- package/src/ts/tests/arrange.stoch.ts +4 -4
- package/src/ts/tests/array_box_if_string.spec.ts +30 -31
- package/src/ts/tests/array_transitions.spec.ts +129 -129
- package/src/ts/tests/arrow unicode.spec.ts +88 -88
- package/src/ts/tests/arrow.spec.ts +124 -124
- package/src/ts/tests/colors.spec.ts +58 -58
- package/src/ts/tests/comment.spec.ts +134 -134
- package/src/ts/tests/compile.spec.ts +79 -79
- package/src/ts/tests/constants.spec.ts +98 -98
- package/src/ts/tests/cycles.spec.ts +153 -153
- package/src/ts/tests/dot_preamble.spec.ts +16 -16
- package/src/ts/tests/embedded_sm.spec.ts +36 -36
- package/src/ts/tests/flow.spec.ts +22 -22
- package/src/ts/tests/forced transitions.spec.ts +26 -26
- package/src/ts/tests/general.spec.ts +933 -933
- package/src/ts/tests/graph node lists.spec.ts +21 -21
- package/src/ts/tests/histo.spec.ts +24 -24
- package/src/ts/tests/hooks.spec.ts +28 -0
- package/src/ts/tests/language.spec.ts +37 -37
- package/src/ts/tests/language_data/belarussian.json +13 -13
- package/src/ts/tests/language_data/bengali.json +15 -15
- package/src/ts/tests/language_data/emoji.json +21 -21
- package/src/ts/tests/language_data/english.json +16 -16
- package/src/ts/tests/language_data/french.json +16 -16
- package/src/ts/tests/language_data/german.json +16 -16
- package/src/ts/tests/language_data/hebrew.json +16 -16
- package/src/ts/tests/language_data/portuguese.json +12 -12
- package/src/ts/tests/language_data/russian.json +12 -12
- package/src/ts/tests/language_data/spanish.json +17 -17
- package/src/ts/tests/language_data/ukrainian.json +18 -18
- package/src/ts/tests/layout.spec.ts +29 -29
- package/src/ts/tests/machine_attributes.spec.ts +398 -398
- package/src/ts/tests/machine_name.spec.ts +14 -14
- package/src/ts/tests/named lists.spec.ts +24 -19
- package/src/ts/tests/nominated states.spec.ts +133 -133
- package/src/ts/tests/parse actions.spec.ts +32 -32
- package/src/ts/tests/parse.spec.ts +94 -94
- package/src/ts/tests/probability.spec.ts +146 -146
- package/src/ts/tests/r639.spec.ts +27 -27
- package/src/ts/tests/sample_select.spec.ts +173 -173
- package/src/ts/tests/seq.spec.ts +14 -16
- package/src/ts/tests/seq.stoch.ts +83 -0
- package/src/ts/tests/shapes.spec.ts +63 -63
- package/src/ts/tests/sm_tag.spec.ts +37 -37
- package/src/ts/tests/special characters.spec.ts +39 -39
- package/src/ts/tests/state_declaration.spec.ts +214 -200
- package/src/ts/tests/state_style.spec.ts +82 -39
- package/src/ts/tests/stop light.spec.ts +157 -157
- package/src/ts/tests/stripes.spec.ts +52 -52
- package/src/ts/tests/theme.spec.ts +45 -45
- package/src/ts/tests/weighted_histo_key.spec.ts +22 -22
- package/src/ts/tests/weighted_rand_select.spec.ts +27 -27
- package/src/ts/tests/weighted_sample_select.spec.ts +24 -26
- package/src/ts/version.ts +1 -1
- package/tree.txt +1794 -1794
- package/tsconfig.json +27 -27
- package/version.d.ts +2 -2
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
/* eslint-disable max-len */
|
|
3
|
-
|
|
4
|
-
import * as jssm from '../jssm';
|
|
5
|
-
|
|
6
|
-
const sm = jssm.sm;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
describe('compile/1', () => {
|
|
13
|
-
|
|
14
|
-
describe('a->b;', () => {
|
|
15
|
-
const a_to_b_str = `a->b;`;
|
|
16
|
-
test('doesn\'t throw', () => expect( () => {
|
|
17
|
-
jssm.compile(jssm.parse(a_to_b_str));
|
|
18
|
-
}).not.toThrow() );
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
describe('a->b->c;', () => {
|
|
22
|
-
const a_to_b_to_c_str = `a->b->c;`;
|
|
23
|
-
test('doesn\'t throw', () => expect( () => {
|
|
24
|
-
jssm.compile(jssm.parse(a_to_b_to_c_str));
|
|
25
|
-
}).not.toThrow() );
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
describe('template tokens', () => {
|
|
29
|
-
const a_through_e_token_str = `a->${'b'}->c->${'d'}->e;`;
|
|
30
|
-
test('doesn\'t throw', () => expect( () => {
|
|
31
|
-
jssm.compile(jssm.parse(a_through_e_token_str));
|
|
32
|
-
}).not.toThrow() );
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
describe('all arrows', () => {
|
|
36
|
-
const all_arrows = `a -> b => c ~> d <-> e <=> f <~> g <-=> h <=-> i <~-> j <-~> k <=~> l <~=> m <- n <= o <~ p;`;
|
|
37
|
-
test('doesn\'t throw', () => expect( () => {
|
|
38
|
-
jssm.compile(jssm.parse(all_arrows));
|
|
39
|
-
}).not.toThrow() );
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
describe('all unicode arrows', () => {
|
|
43
|
-
const all_arrows = `a ← b ⇐ c ↚ d → e ⇒ f ↛ g ↔ h ⇔ i ↮ j ←⇒ k ⇐→ l ←↛ m ↚→ n ⇐↛ o ↚⇒ p;`;
|
|
44
|
-
test('doesn\'t throw', () => expect( () => {
|
|
45
|
-
jssm.compile(jssm.parse(all_arrows));
|
|
46
|
-
}).not.toThrow() );
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
describe('error catchery', () => {
|
|
56
|
-
|
|
57
|
-
test.todo('uncomment the compile spec tests once they\'re understood');
|
|
58
|
-
|
|
59
|
-
describe('unknown rule', () => {
|
|
60
|
-
test('throws', () => expect( () => {
|
|
61
|
-
jssm.compile( [{"key":"FAKE_RULE","from":"a","se":{"kind":"->","to":"b"}}] as any );
|
|
62
|
-
} ).toThrow() );
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
describe('unnamed state_declaration', () => {
|
|
66
|
-
test('throws', () => expect( () => {
|
|
67
|
-
jssm.compile( [{"key":"state_declaration"}] as any );
|
|
68
|
-
} ).toThrow() );
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
describe('unknown state property', () => {
|
|
72
|
-
test('throws', () => expect( () => {
|
|
73
|
-
sm`a->b; c: { foo: red; };`;
|
|
74
|
-
} ).toThrow() );
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
// stochable
|
|
1
|
+
|
|
2
|
+
/* eslint-disable max-len */
|
|
3
|
+
|
|
4
|
+
import * as jssm from '../jssm';
|
|
5
|
+
|
|
6
|
+
const sm = jssm.sm;
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
describe('compile/1', () => {
|
|
13
|
+
|
|
14
|
+
describe('a->b;', () => {
|
|
15
|
+
const a_to_b_str = `a->b;`;
|
|
16
|
+
test('doesn\'t throw', () => expect( () => {
|
|
17
|
+
jssm.compile(jssm.parse(a_to_b_str));
|
|
18
|
+
}).not.toThrow() );
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
describe('a->b->c;', () => {
|
|
22
|
+
const a_to_b_to_c_str = `a->b->c;`;
|
|
23
|
+
test('doesn\'t throw', () => expect( () => {
|
|
24
|
+
jssm.compile(jssm.parse(a_to_b_to_c_str));
|
|
25
|
+
}).not.toThrow() );
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
describe('template tokens', () => {
|
|
29
|
+
const a_through_e_token_str = `a->${'b'}->c->${'d'}->e;`;
|
|
30
|
+
test('doesn\'t throw', () => expect( () => {
|
|
31
|
+
jssm.compile(jssm.parse(a_through_e_token_str));
|
|
32
|
+
}).not.toThrow() );
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe('all arrows', () => {
|
|
36
|
+
const all_arrows = `a -> b => c ~> d <-> e <=> f <~> g <-=> h <=-> i <~-> j <-~> k <=~> l <~=> m <- n <= o <~ p;`;
|
|
37
|
+
test('doesn\'t throw', () => expect( () => {
|
|
38
|
+
jssm.compile(jssm.parse(all_arrows));
|
|
39
|
+
}).not.toThrow() );
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe('all unicode arrows', () => {
|
|
43
|
+
const all_arrows = `a ← b ⇐ c ↚ d → e ⇒ f ↛ g ↔ h ⇔ i ↮ j ←⇒ k ⇐→ l ←↛ m ↚→ n ⇐↛ o ↚⇒ p;`;
|
|
44
|
+
test('doesn\'t throw', () => expect( () => {
|
|
45
|
+
jssm.compile(jssm.parse(all_arrows));
|
|
46
|
+
}).not.toThrow() );
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
describe('error catchery', () => {
|
|
56
|
+
|
|
57
|
+
test.todo('uncomment the compile spec tests once they\'re understood');
|
|
58
|
+
|
|
59
|
+
describe('unknown rule', () => {
|
|
60
|
+
test('throws', () => expect( () => {
|
|
61
|
+
jssm.compile( [{"key":"FAKE_RULE","from":"a","se":{"kind":"->","to":"b"}}] as any );
|
|
62
|
+
} ).toThrow() );
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
describe('unnamed state_declaration', () => {
|
|
66
|
+
test('throws', () => expect( () => {
|
|
67
|
+
jssm.compile( [{"key":"state_declaration"}] as any );
|
|
68
|
+
} ).toThrow() );
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
describe('unknown state property', () => {
|
|
72
|
+
test('throws', () => expect( () => {
|
|
73
|
+
sm`a->b; c: { foo: red; };`;
|
|
74
|
+
} ).toThrow() );
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// stochable
|
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
|
|
2
|
-
/* In general, this shouldn't import anything, because this is both run and
|
|
3
|
-
partially imported by other things. */
|
|
4
|
-
|
|
5
|
-
/* We make an exception for arr_uniq_p() from util */
|
|
6
|
-
|
|
7
|
-
import { arr_uniq_p } from '../jssm_util';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/* constant lists for tests */
|
|
14
|
-
|
|
15
|
-
test.todo('These constants should be derived from the source and compared');
|
|
16
|
-
|
|
17
|
-
const Shapes = ["box", "polygon", "ellipse", "oval", "circle", "point", "egg", "triangle", "plaintext", "plain",
|
|
18
|
-
"diamond", "trapezium", "parallelogram", "house", "pentagon", "hexagon", "septagon", "octagon", "doublecircle",
|
|
19
|
-
"doubleoctagon", "tripleoctagon", "invtriangle", "invtrapezium", "invhouse", "Mdiamond", "Msquare", "Mcircle", "rect",
|
|
20
|
-
"rectangle", "square", "star", "none", "underline", "cylinder", "note", "tab", "folder", "box3d", "component",
|
|
21
|
-
"promoter", "cds", "terminator", "utr", "primersite", "restrictionsite", "fivepoverhang", "threepoverhang",
|
|
22
|
-
"noverhang", "assembly", "signature", "insulator", "ribosite", "rnastab", "proteasesite", "proteinstab", "rpromoter",
|
|
23
|
-
"rarrow", "larrow", "lpromoter", "record"];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const NamedColors = ["AliceBlue", "AntiqueWhite", "Aqua", "Aquamarine", "Azure", "Beige", "Bisque", "Black",
|
|
30
|
-
"BlanchedAlmond", "Blue", "BlueViolet", "Brown", "BurlyWood", "CadetBlue", "Chartreuse", "Chocolate", "Coral",
|
|
31
|
-
"CornflowerBlue", "Cornsilk", "Crimson", "Cyan", "DarkBlue", "DarkCyan", "DarkGoldenRod", "DarkGray", "DarkGrey",
|
|
32
|
-
"DarkGreen", "DarkKhaki", "DarkMagenta", "DarkOliveGreen", "Darkorange", "DarkOrchid", "DarkRed", "DarkSalmon",
|
|
33
|
-
"DarkSeaGreen", "DarkSlateBlue", "DarkSlateGray", "DarkSlateGrey", "DarkTurquoise", "DarkViolet", "DeepPink",
|
|
34
|
-
"DeepSkyBlue", "DimGray", "DimGrey", "DodgerBlue", "FireBrick", "FloralWhite", "ForestGreen", "Fuchsia", "Gainsboro",
|
|
35
|
-
"GhostWhite", "Gold", "GoldenRod", "Gray", "Grey", "Green", "GreenYellow", "HoneyDew", "HotPink", "IndianRed",
|
|
36
|
-
"Indigo", "Ivory", "Khaki", "Lavender", "LavenderBlush", "LawnGreen", "LemonChiffon", "LightBlue", "LightCoral",
|
|
37
|
-
"LightCyan", "LightGoldenRodYellow", "LightGray", "LightGrey", "LightGreen", "LightPink", "LightSalmon",
|
|
38
|
-
"LightSeaGreen", "LightSkyBlue", "LightSlateGray", "LightSlateGrey", "LightSteelBlue", "LightYellow", "Lime",
|
|
39
|
-
"LimeGreen", "Linen", "Magenta", "Maroon", "MediumAquaMarine", "MediumBlue", "MediumOrchid", "MediumPurple",
|
|
40
|
-
"MediumSeaGreen", "MediumSlateBlue", "MediumSpringGreen", "MediumTurquoise", "MediumVioletRed", "MidnightBlue",
|
|
41
|
-
"MintCream", "MistyRose", "Moccasin", "NavajoWhite", "Navy", "OldLace", "Olive", "OliveDrab", "Orange", "OrangeRed",
|
|
42
|
-
"Orchid", "PaleGoldenRod", "PaleGreen", "PaleTurquoise", "PaleVioletRed", "PapayaWhip", "PeachPuff", "Peru", "Pink",
|
|
43
|
-
"Plum", "PowderBlue", "Purple", "Red", "RosyBrown", "RoyalBlue", "SaddleBrown", "Salmon", "SandyBrown", "SeaGreen",
|
|
44
|
-
"SeaShell", "Sienna", "Silver", "SkyBlue", "SlateBlue", "SlateGray", "SlateGrey", "Snow", "SpringGreen", "SteelBlue",
|
|
45
|
-
"Tan", "Teal", "Thistle", "Tomato", "Turquoise", "Violet", "Wheat", "White", "WhiteSmoke", "Yellow", "YellowGreen"];
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const Themes
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
// for coverage, and because ava throws on no-test files in its test directory
|
|
60
|
-
|
|
61
|
-
describe('Constants test lists', () => {
|
|
62
|
-
|
|
63
|
-
const testdata: [ string, string[] ][] = [
|
|
64
|
-
[ 'Shapes', Shapes ],
|
|
65
|
-
[ 'NamedColors', NamedColors ],
|
|
66
|
-
[ 'Themes', Themes ],
|
|
67
|
-
[ 'FlowDirections', FlowDirections ]
|
|
68
|
-
];
|
|
69
|
-
|
|
70
|
-
testdata.map(datum => {
|
|
71
|
-
|
|
72
|
-
test(`List "${datum[0]}" is an array`, () =>
|
|
73
|
-
expect( Array.isArray(datum[1]) ).toBe(true) );
|
|
74
|
-
|
|
75
|
-
test(`List "${datum[0]}" isn't empty`, () =>
|
|
76
|
-
expect( datum[1].length > 1 ).toBe(true) );
|
|
77
|
-
|
|
78
|
-
test(`List "${datum[0]}" contains no null, undefined, or holes`, () =>
|
|
79
|
-
// eslint-disable-next-line no-eq-null, eqeqeq
|
|
80
|
-
expect( datum[1].length == null ).toBe(false) ); // LEAVE THIS DOUBLE-EQUALS
|
|
81
|
-
|
|
82
|
-
test(`List "${datum[0]}" contains no empty strings`, () =>
|
|
83
|
-
expect( datum[1].every(s => s !== '') ).toBe(true) );
|
|
84
|
-
|
|
85
|
-
test(`List "${datum[0]}" contains no repetitions`, () => {
|
|
86
|
-
const deduped = datum[1].filter(arr_uniq_p);
|
|
87
|
-
expect( datum[1].length ).toBe(deduped.length);
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
export { NamedColors, Shapes, Themes, FlowDirections };
|
|
1
|
+
|
|
2
|
+
/* In general, this shouldn't import anything, because this is both run and
|
|
3
|
+
partially imported by other things. */
|
|
4
|
+
|
|
5
|
+
/* We make an exception for arr_uniq_p() from util */
|
|
6
|
+
|
|
7
|
+
import { arr_uniq_p } from '../jssm_util';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/* constant lists for tests */
|
|
14
|
+
|
|
15
|
+
test.todo('These constants should be derived from the source and compared');
|
|
16
|
+
|
|
17
|
+
const Shapes = ["box", "polygon", "ellipse", "oval", "circle", "point", "egg", "triangle", "plaintext", "plain",
|
|
18
|
+
"diamond", "trapezium", "parallelogram", "house", "pentagon", "hexagon", "septagon", "octagon", "doublecircle",
|
|
19
|
+
"doubleoctagon", "tripleoctagon", "invtriangle", "invtrapezium", "invhouse", "Mdiamond", "Msquare", "Mcircle", "rect",
|
|
20
|
+
"rectangle", "square", "star", "none", "underline", "cylinder", "note", "tab", "folder", "box3d", "component",
|
|
21
|
+
"promoter", "cds", "terminator", "utr", "primersite", "restrictionsite", "fivepoverhang", "threepoverhang",
|
|
22
|
+
"noverhang", "assembly", "signature", "insulator", "ribosite", "rnastab", "proteasesite", "proteinstab", "rpromoter",
|
|
23
|
+
"rarrow", "larrow", "lpromoter", "record"];
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
const NamedColors = ["AliceBlue", "AntiqueWhite", "Aqua", "Aquamarine", "Azure", "Beige", "Bisque", "Black",
|
|
30
|
+
"BlanchedAlmond", "Blue", "BlueViolet", "Brown", "BurlyWood", "CadetBlue", "Chartreuse", "Chocolate", "Coral",
|
|
31
|
+
"CornflowerBlue", "Cornsilk", "Crimson", "Cyan", "DarkBlue", "DarkCyan", "DarkGoldenRod", "DarkGray", "DarkGrey",
|
|
32
|
+
"DarkGreen", "DarkKhaki", "DarkMagenta", "DarkOliveGreen", "Darkorange", "DarkOrchid", "DarkRed", "DarkSalmon",
|
|
33
|
+
"DarkSeaGreen", "DarkSlateBlue", "DarkSlateGray", "DarkSlateGrey", "DarkTurquoise", "DarkViolet", "DeepPink",
|
|
34
|
+
"DeepSkyBlue", "DimGray", "DimGrey", "DodgerBlue", "FireBrick", "FloralWhite", "ForestGreen", "Fuchsia", "Gainsboro",
|
|
35
|
+
"GhostWhite", "Gold", "GoldenRod", "Gray", "Grey", "Green", "GreenYellow", "HoneyDew", "HotPink", "IndianRed",
|
|
36
|
+
"Indigo", "Ivory", "Khaki", "Lavender", "LavenderBlush", "LawnGreen", "LemonChiffon", "LightBlue", "LightCoral",
|
|
37
|
+
"LightCyan", "LightGoldenRodYellow", "LightGray", "LightGrey", "LightGreen", "LightPink", "LightSalmon",
|
|
38
|
+
"LightSeaGreen", "LightSkyBlue", "LightSlateGray", "LightSlateGrey", "LightSteelBlue", "LightYellow", "Lime",
|
|
39
|
+
"LimeGreen", "Linen", "Magenta", "Maroon", "MediumAquaMarine", "MediumBlue", "MediumOrchid", "MediumPurple",
|
|
40
|
+
"MediumSeaGreen", "MediumSlateBlue", "MediumSpringGreen", "MediumTurquoise", "MediumVioletRed", "MidnightBlue",
|
|
41
|
+
"MintCream", "MistyRose", "Moccasin", "NavajoWhite", "Navy", "OldLace", "Olive", "OliveDrab", "Orange", "OrangeRed",
|
|
42
|
+
"Orchid", "PaleGoldenRod", "PaleGreen", "PaleTurquoise", "PaleVioletRed", "PapayaWhip", "PeachPuff", "Peru", "Pink",
|
|
43
|
+
"Plum", "PowderBlue", "Purple", "Red", "RosyBrown", "RoyalBlue", "SaddleBrown", "Salmon", "SandyBrown", "SeaGreen",
|
|
44
|
+
"SeaShell", "Sienna", "Silver", "SkyBlue", "SlateBlue", "SlateGray", "SlateGrey", "Snow", "SpringGreen", "SteelBlue",
|
|
45
|
+
"Tan", "Teal", "Thistle", "Tomato", "Turquoise", "Violet", "Wheat", "White", "WhiteSmoke", "Yellow", "YellowGreen"];
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
const Themes = ['default', 'ocean', 'none', 'modern'],
|
|
52
|
+
FlowDirections = ['up','down','left','right'],
|
|
53
|
+
LineStyles = ['solid', 'dotted', 'dashed'];
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
// for coverage, and because ava throws on no-test files in its test directory
|
|
60
|
+
|
|
61
|
+
describe('Constants test lists', () => {
|
|
62
|
+
|
|
63
|
+
const testdata: [ string, string[] ][] = [
|
|
64
|
+
[ 'Shapes', Shapes ],
|
|
65
|
+
[ 'NamedColors', NamedColors ],
|
|
66
|
+
[ 'Themes', Themes ],
|
|
67
|
+
[ 'FlowDirections', FlowDirections ]
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
testdata.map(datum => {
|
|
71
|
+
|
|
72
|
+
test(`List "${datum[0]}" is an array`, () =>
|
|
73
|
+
expect( Array.isArray(datum[1]) ).toBe(true) );
|
|
74
|
+
|
|
75
|
+
test(`List "${datum[0]}" isn't empty`, () =>
|
|
76
|
+
expect( datum[1].length > 1 ).toBe(true) );
|
|
77
|
+
|
|
78
|
+
test(`List "${datum[0]}" contains no null, undefined, or holes`, () =>
|
|
79
|
+
// eslint-disable-next-line no-eq-null, eqeqeq
|
|
80
|
+
expect( datum[1].length == null ).toBe(false) ); // LEAVE THIS DOUBLE-EQUALS
|
|
81
|
+
|
|
82
|
+
test(`List "${datum[0]}" contains no empty strings`, () =>
|
|
83
|
+
expect( datum[1].every(s => s !== '') ).toBe(true) );
|
|
84
|
+
|
|
85
|
+
test(`List "${datum[0]}" contains no repetitions`, () => {
|
|
86
|
+
const deduped = datum[1].filter(arr_uniq_p);
|
|
87
|
+
expect( datum[1].length ).toBe(deduped.length);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
export { NamedColors, Shapes, Themes, FlowDirections, LineStyles };
|