jssm 5.44.0 → 5.46.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 (85) hide show
  1. package/dist/es6/jssm.d.ts +6 -1
  2. package/dist/es6/jssm.js +104 -14
  3. package/dist/es6/jssm_types.d.ts +26 -1
  4. package/dist/es6/jssm_util.d.ts +3 -1
  5. package/dist/es6/jssm_util.js +3 -1
  6. package/dist/es6/version.js +1 -1
  7. package/dist/jssm.es5.cjs.js +1 -1
  8. package/jssm.d.ts +6 -1
  9. package/jssm_types.d.ts +26 -1
  10. package/jssm_util.d.ts +3 -1
  11. package/package.json +2 -3
  12. package/.codeclimate.yml +0 -22
  13. package/.editorconfig +0 -12
  14. package/.eslintrc +0 -20
  15. package/.nycrc +0 -6
  16. package/.travis.yml +0 -9
  17. package/dist/jssm.es5.iife.js +0 -1
  18. package/jest-spec.config.js +0 -27
  19. package/jest-stoch.config.js +0 -27
  20. package/rollup.config.iife.js +0 -44
  21. package/rollup.config.js +0 -44
  22. package/src/demo/index.html +0 -38
  23. package/src/demo/style.css +0 -2
  24. package/src/ts/jssm-dot.peg +0 -928
  25. package/src/ts/jssm.ts +0 -1120
  26. package/src/ts/jssm_types.ts +0 -346
  27. package/src/ts/jssm_util.ts +0 -100
  28. package/src/ts/tests/actions.spec.ts +0 -167
  29. package/src/ts/tests/arrange.spec.ts +0 -72
  30. package/src/ts/tests/arrange.stoch.ts +0 -4
  31. package/src/ts/tests/array_box_if_string.spec.ts +0 -30
  32. package/src/ts/tests/array_transitions.spec.ts +0 -129
  33. package/src/ts/tests/arrow unicode.spec.ts +0 -88
  34. package/src/ts/tests/arrow.spec.ts +0 -124
  35. package/src/ts/tests/colors.spec.ts +0 -58
  36. package/src/ts/tests/comment.spec.ts +0 -134
  37. package/src/ts/tests/compile.spec.ts +0 -79
  38. package/src/ts/tests/constants.spec.ts +0 -98
  39. package/src/ts/tests/cycles.spec.ts +0 -153
  40. package/src/ts/tests/dot_preamble.spec.ts +0 -16
  41. package/src/ts/tests/embedded_sm.spec.ts +0 -36
  42. package/src/ts/tests/flow.spec.ts +0 -22
  43. package/src/ts/tests/forced transitions.spec.ts +0 -26
  44. package/src/ts/tests/general.spec.ts +0 -933
  45. package/src/ts/tests/graph node lists.spec.ts +0 -21
  46. package/src/ts/tests/histo.spec.ts +0 -24
  47. package/src/ts/tests/hooks.spec.ts +0 -28
  48. package/src/ts/tests/language.spec.ts +0 -37
  49. package/src/ts/tests/language_data/belarussian.json +0 -14
  50. package/src/ts/tests/language_data/bengali.json +0 -16
  51. package/src/ts/tests/language_data/emoji.json +0 -22
  52. package/src/ts/tests/language_data/english.json +0 -17
  53. package/src/ts/tests/language_data/french.json +0 -17
  54. package/src/ts/tests/language_data/german.json +0 -17
  55. package/src/ts/tests/language_data/hebrew.json +0 -16
  56. package/src/ts/tests/language_data/portuguese.json +0 -13
  57. package/src/ts/tests/language_data/russian.json +0 -13
  58. package/src/ts/tests/language_data/spanish.json +0 -17
  59. package/src/ts/tests/language_data/ukrainian.json +0 -19
  60. package/src/ts/tests/layout.spec.ts +0 -29
  61. package/src/ts/tests/machine_attributes.spec.ts +0 -398
  62. package/src/ts/tests/machine_name.spec.ts +0 -14
  63. package/src/ts/tests/named lists.spec.ts +0 -24
  64. package/src/ts/tests/nominated states.spec.ts +0 -133
  65. package/src/ts/tests/parse actions.spec.ts +0 -32
  66. package/src/ts/tests/parse.spec.ts +0 -94
  67. package/src/ts/tests/probability.spec.ts +0 -146
  68. package/src/ts/tests/r639.spec.ts +0 -27
  69. package/src/ts/tests/sample_select.spec.ts +0 -173
  70. package/src/ts/tests/seq.spec.ts +0 -14
  71. package/src/ts/tests/seq.stoch.ts +0 -83
  72. package/src/ts/tests/shapes.spec.ts +0 -63
  73. package/src/ts/tests/sm_tag.spec.ts +0 -37
  74. package/src/ts/tests/special characters.spec.ts +0 -39
  75. package/src/ts/tests/state_declaration.spec.ts +0 -214
  76. package/src/ts/tests/state_style.spec.ts +0 -82
  77. package/src/ts/tests/stop light.spec.ts +0 -157
  78. package/src/ts/tests/stripes.spec.ts +0 -52
  79. package/src/ts/tests/theme.spec.ts +0 -45
  80. package/src/ts/tests/weighted_histo_key.spec.ts +0 -22
  81. package/src/ts/tests/weighted_rand_select.spec.ts +0 -27
  82. package/src/ts/tests/weighted_sample_select.spec.ts +0 -24
  83. package/src/ts/version.ts +0 -3
  84. package/tree.txt +0 -1794
  85. package/tsconfig.json +0 -27
@@ -1,346 +0,0 @@
1
-
2
- type StateType = string;
3
-
4
-
5
-
6
-
7
-
8
- type JssmSuccess = { success: true };
9
- type JssmFailure = { success: false, error: any };
10
- type JssmIncomplete = { success: 'incomplete' };
11
- type JssmResult = JssmSuccess | JssmFailure | JssmIncomplete;
12
-
13
- type JssmColor = string; // TODO FIXME constrain to #RRGGBBAA later // whargarbl
14
-
15
-
16
-
17
- type JssmPermitted = 'required' | 'disallowed';
18
- type JssmPermittedOpt = 'required' | 'disallowed' | 'optional';
19
-
20
- type JssmArrow = '->' | '<-' | '<->' | '<=->' | '<~->'
21
- | '=>' | '<=' | '<=>' | '<-=>' | '<~=>'
22
- | '~>' | '<~' | '<~>' | '<-~>' | '<=~>';
23
- // | '⇒' | '⇐' | '⇔' | '⇐→' | '↚→'
24
- // | '→' | '←' | '↔' | '←⇒' | '↚⇒'
25
- // | '↛' | '↚' | '↮' | '←↛' | '⇐↛';
26
-
27
- // TODO finish the arrow types - unicode *and* mixed
28
-
29
- type JssmShape = "box" | "polygon" | "ellipse" | "oval" | "circle" | "point" | "egg" | "triangle"
30
- | "plaintext" | "plain" | "diamond" | "trapezium" | "parallelogram" | "house" | "pentagon"
31
- | "hexagon" | "septagon" | "octagon" | "doublecircle" | "doubleoctagon" | "tripleoctagon"
32
- | "invtriangle" | "invtrapezium" | "invhouse" | "Mdiamond" | "Msquare" | "Mcircle" | "rect"
33
- | "rectangle" | "square" | "star" | "none" | "underline" | "cylinder" | "note" | "tab"
34
- | "folder" | "box3d" | "component" | "promoter" | "cds" | "terminator" | "utr" | "primersite"
35
- | "restrictionsite" | "fivepoverhang" | "threepoverhang" | "noverhang" | "assembly"
36
- | "signature" | "insulator" | "ribosite" | "rnastab" | "proteasesite" | "proteinstab"
37
- | "rpromoter" | "rarrow" | "larrow" | "lpromoter" | "record";
38
-
39
- type JssmArrowDirection = 'left' | 'right' | 'both';
40
- type JssmArrowKind = 'none' | 'legal' | 'main' | 'forced';
41
-
42
- type JssmLayout = 'dot' | 'circo' | 'twopi' | 'fdp'; // todo add the rest
43
-
44
- type JssmCorner = 'regular' | 'rounded' | 'lined';
45
- type JssmLineStyle = 'solid' | 'dashed' | 'dotted';
46
-
47
-
48
-
49
-
50
-
51
- type FslDirection = 'up' | 'right' | 'down' | 'left';
52
- type FslTheme = 'default' | 'ocean' | 'modern' | 'none';
53
-
54
-
55
-
56
-
57
-
58
- type State = string;
59
-
60
-
61
-
62
-
63
-
64
- type JssmTransitionPermitter<DataType> =
65
- (OldState: StateType, NewState: StateType, OldData: DataType, NewData: DataType) => boolean;
66
-
67
- type JssmTransitionPermitterMaybeArray<DataType> =
68
- JssmTransitionPermitter<DataType>
69
- | Array< JssmTransitionPermitter<DataType> >;
70
-
71
-
72
-
73
-
74
-
75
- type JssmTransition<DataType> = {
76
-
77
- from : StateType,
78
- to : StateType,
79
- name? : string,
80
- action? : StateType,
81
- check? : JssmTransitionPermitterMaybeArray<DataType>, // validate this edge's transition; usually about data
82
- probability? : number, // for stoch modelling, would like to constrain to [0..1], dunno how // TODO FIXME
83
- kind : JssmArrowKind,
84
- forced_only : boolean,
85
- main_path : boolean
86
-
87
- };
88
-
89
- type JssmTransitions<DataType> =
90
- Array< JssmTransition<DataType> >;
91
-
92
- type JssmTransitionList = {
93
- entrances : Array<StateType>,
94
- exits : Array<StateType>
95
- };
96
-
97
- type JssmTransitionCycle = {
98
- key : 'cycle',
99
- value : StateType
100
- };
101
-
102
- type JssmTransitionRule =
103
- StateType
104
- | JssmTransitionCycle;
105
-
106
-
107
-
108
-
109
-
110
- type JssmGenericState = {
111
-
112
- from : Array< StateType > ,
113
- name : StateType ,
114
- to : Array< StateType > ,
115
- complete : boolean
116
-
117
- };
118
-
119
-
120
-
121
-
122
-
123
- type JssmMachineInternalState<DataType> = {
124
-
125
- internal_state_impl_version : 1,
126
-
127
- state : StateType,
128
- states : Map< StateType, JssmGenericState >,
129
- named_transitions : Map< StateType, number >,
130
- edge_map : Map< StateType, Map<StateType, number> >,
131
- actions : Map< StateType, Map<StateType, number> >,
132
- reverse_actions : Map< StateType, Map<StateType, number> >,
133
- edges : Array< JssmTransition<DataType> >
134
-
135
- };
136
-
137
-
138
-
139
-
140
-
141
- type JssmStatePermitter<DataType> =
142
- (OldState: StateType, NewState: StateType, OldData: DataType, NewData: DataType) => boolean;
143
-
144
- type JssmStatePermitterMaybeArray<DataType> =
145
- JssmStatePermitter<DataType> | Array< JssmStatePermitter<DataType> >;
146
-
147
- type JssmGenericMachine<DataType> = {
148
-
149
- name? : string,
150
- state : StateType,
151
- data? : DataType,
152
- nodes? : Array<StateType>,
153
- transitions : JssmTransitions<DataType>,
154
- check? : JssmStatePermitterMaybeArray<DataType>,
155
-
156
- min_transitions? : number,
157
- max_transitions? : number,
158
-
159
- allow_empty? : boolean,
160
- allow_islands? : boolean,
161
- allow_force? : boolean,
162
-
163
- keep_history? : boolean | number
164
-
165
- };
166
-
167
-
168
-
169
-
170
-
171
- type JssmStateDeclarationRule = {
172
- key : string,
173
- value : any // TODO FIXME COMEBACK enumerate types against concrete keys
174
- };
175
-
176
- type JssmStateDeclaration = {
177
-
178
- declarations : Array<JssmStateDeclarationRule>,
179
-
180
- shape? : JssmShape,
181
- color? : JssmColor,
182
- corners? : JssmCorner,
183
- linestyle? : JssmLineStyle,
184
-
185
- textColor? : JssmColor,
186
- backgroundColor? : JssmColor,
187
- borderColor? : JssmColor,
188
-
189
- state : StateType
190
-
191
- };
192
-
193
-
194
-
195
-
196
-
197
- type JssmGenericConfig<DataType> = {
198
-
199
- graph_layout? : JssmLayout,
200
-
201
- complete? : Array<StateType>,
202
- transitions : JssmTransitions<DataType>,
203
-
204
- theme? : FslTheme,
205
- flow? : FslDirection,
206
-
207
- name? : string,
208
- data? : DataType,
209
- nodes? : Array<StateType>, // uncommon
210
- check? : JssmStatePermitterMaybeArray<DataType>,
211
-
212
- //locked? : bool = true,
213
- min_exits? : number,
214
- max_exits? : number,
215
- allow_islands? : false,
216
- allow_force? : false,
217
- actions? : JssmPermittedOpt,
218
-
219
- simplify_bidi? : boolean,
220
-
221
- dot_preamble? : string,
222
-
223
- start_states : Array<StateType>,
224
- end_states? : Array<StateType>,
225
-
226
- state_declaration? : Array<Object>,
227
-
228
- arrange_declaration? : Array<Array<StateType>>,
229
- arrange_start_declaration? : Array<Array<StateType>>,
230
- arrange_end_declaration? : Array<Array<StateType>>,
231
-
232
- machine_author? : string | Array<string>,
233
- machine_comment? : string,
234
- machine_contributor? : string | Array<string>,
235
- machine_definition? : string,
236
- machine_language? : string, // TODO FIXME COMEBACK
237
- machine_license? : string, // TODO FIXME COMEBACK
238
- machine_name? : string,
239
- machine_version? : string, // TODO FIXME COMEBACK
240
-
241
- fsl_version? : string, // TODO FIXME COMEBACK
242
-
243
- auto_api? : boolean | string // TODO FIXME COMEBACK // boolean false means don't; boolean true means do; string means do-with-this-prefix
244
-
245
- };
246
-
247
-
248
-
249
-
250
-
251
- type JssmCompileRule = {
252
-
253
- agg_as : string,
254
- val : any // TODO COMEBACK FIXME
255
-
256
- };
257
-
258
-
259
-
260
-
261
-
262
- type JssmCompileSe = {
263
-
264
- to : StateType,
265
- se : JssmCompileSe,
266
- kind : JssmArrow,
267
- l_action? : StateType,
268
- r_action? : StateType,
269
- l_probability : number,
270
- r_probability : number
271
-
272
- };
273
-
274
-
275
-
276
-
277
-
278
- type JssmCompileSeStart<DataType> = {
279
-
280
- from : DataType,
281
- se : JssmCompileSe,
282
- key : string,
283
- value? : string | number,
284
- name? : string
285
-
286
- };
287
-
288
-
289
-
290
-
291
-
292
- type JssmParseTree =
293
-
294
- Array< JssmCompileSeStart<StateType> >;
295
-
296
-
297
-
298
-
299
-
300
- type JssmParseFunctionType =
301
-
302
- (string) => JssmParseTree;
303
-
304
-
305
-
306
-
307
-
308
- export {
309
-
310
- JssmColor,
311
-
312
- JssmTransition,
313
- JssmTransitions,
314
- JssmTransitionList,
315
- JssmTransitionRule,
316
-
317
- JssmArrow,
318
- JssmArrowKind,
319
- JssmArrowDirection,
320
-
321
- JssmGenericConfig,
322
- JssmGenericState,
323
- JssmGenericMachine,
324
-
325
- JssmParseTree,
326
- JssmCompileSe,
327
- JssmCompileSeStart,
328
- JssmCompileRule,
329
-
330
- JssmPermitted,
331
- JssmPermittedOpt,
332
- JssmResult,
333
-
334
- JssmStateDeclaration,
335
- JssmStateDeclarationRule,
336
-
337
- JssmLayout,
338
-
339
- JssmParseFunctionType,
340
-
341
- JssmMachineInternalState,
342
-
343
- FslDirection,
344
- FslTheme
345
-
346
- };
@@ -1,100 +0,0 @@
1
-
2
- function arr_uniq_p<T>(el: T, i: number, source: T[]): boolean {
3
- return source.indexOf(el) === i;
4
- }
5
-
6
-
7
-
8
-
9
-
10
- const array_box_if_string = n =>
11
- typeof n === 'string'? [n] : n;
12
-
13
-
14
-
15
-
16
-
17
- // this is explicitly about other peoples' data, so it has to be weakly typed
18
- /* eslint-disable flowtype/no-weak-types */
19
- const weighted_rand_select: Function = (options: Array<any>, probability_property: string = 'probability'): any => {
20
-
21
- if (!Array.isArray(options)) {
22
- throw new TypeError('options must be a non-empty array of objects');
23
- }
24
-
25
- if (!(typeof options[0] === 'object')) {
26
- throw new TypeError('options must be a non-empty array of objects');
27
- }
28
-
29
- const frand : Function = (cap): number => Math.random() * cap,
30
- or_one : Function = (item): any => item === undefined? 1 : item,
31
- prob_sum : number = options.reduce( (acc, val:any): number => acc + or_one(val[probability_property]), 0 ),
32
- rnd : number = frand(prob_sum);
33
-
34
- let cursor : number = 0,
35
- cursor_sum : number = 0;
36
-
37
- while ((cursor_sum += or_one(options[cursor++][probability_property])) <= rnd) { } // eslint-disable-line no-empty,fp/no-loops
38
- return options[cursor-1];
39
-
40
- };
41
- /* eslint-enable flowtype/no-weak-types */
42
-
43
-
44
-
45
-
46
-
47
- const seq: Function = (n: number): Array<number> =>
48
-
49
- (new Array(n)).fill(true)
50
- .map( (_, i): number => i );
51
-
52
-
53
-
54
-
55
-
56
- const histograph: Function = (ar : Array<any>): Map<any, number> => // eslint-disable-line flowtype/no-weak-types
57
-
58
- ar.sort()
59
- .reduce(
60
- (m,v): Map<any, any> => // TODO FIXME eslint-disable-line flowtype/no-weak-types,no-sequences
61
- ( m.set(v, (m.has(v)? m.get(v)+1 : 1)) , m),
62
- new Map()
63
- );
64
-
65
-
66
-
67
-
68
-
69
- const weighted_sample_select: Function = (n: number, options: Array<any>, probability_property: string): Array<any> => // TODO FIXME no any // eslint-disable-line flowtype/no-weak-types
70
-
71
- seq(n)
72
- .map( (_i): any => // TODO FIXME eslint-disable-line flowtype/no-weak-types
73
- weighted_rand_select(options, probability_property)
74
- );
75
-
76
-
77
-
78
-
79
-
80
- const weighted_histo_key: Function = (n: number, opts: Array<any>, prob_prop: string, extract: string): Array<any> => // TODO FIXME no any // eslint-disable-line flowtype/no-weak-types
81
-
82
- histograph(
83
- weighted_sample_select(n, opts, prob_prop)
84
- .map(
85
- (s): any => s[extract] // TODO FIXME eslint-disable-line flowtype/no-weak-types
86
- )
87
- );
88
-
89
-
90
-
91
-
92
-
93
- export {
94
- seq,
95
- arr_uniq_p,
96
- histograph, weighted_histo_key,
97
- weighted_rand_select, weighted_sample_select,
98
- array_box_if_string
99
- };
100
-
@@ -1,167 +0,0 @@
1
-
2
- /* eslint-disable max-len */
3
-
4
- import * as jssm from '../jssm';
5
-
6
-
7
-
8
-
9
-
10
- describe('Reports on actions', () => {
11
-
12
- const roa_machine = new jssm.Machine({
13
- start_states : ['off'],
14
- transitions : [
15
- { name: 'turn_on', action: 'power_on', from: 'off', to: 'red', kind: 'legal', forced_only: false, main_path: false }
16
- ]
17
- });
18
-
19
- const roa_la = roa_machine.list_actions(); // todo comeback
20
-
21
- test('Actions that it has', () =>
22
- expect( typeof roa_machine.current_action_for('power_on') )
23
- .toBe('number') );
24
-
25
- test('Actions that it doesn\'t have', () =>
26
- expect( typeof roa_machine.current_action_for('power_left') )
27
- .toBe('undefined') );
28
-
29
- test('Correct list type', () =>
30
- expect( Array.isArray(roa_la) )
31
- .toBe(true) );
32
-
33
- test('Correct list size', () =>
34
- expect( roa_la.length )
35
- .toBe(1) );
36
-
37
- });
38
-
39
-
40
-
41
-
42
-
43
- describe('Actions', () => {
44
-
45
- const act_machine = new jssm.Machine({
46
- start_states : ['off'],
47
- transitions : [
48
- { from: 'off', to: 'red', action: 'on', kind: 'legal', forced_only: false, main_path: false },
49
- { from: 'red', to: 'off', action: 'off', kind: 'legal', forced_only: false, main_path: false }
50
- ]
51
- });
52
-
53
- test('Red has actions().length 1', () =>
54
- expect( act_machine.actions().length )
55
- .toBe(1) );
56
-
57
- test('Red has actions()[0] "on"', () =>
58
- expect( act_machine.actions()[0] )
59
- .toBe('on') );
60
-
61
- test('Red has actions().length 1 again', () =>
62
- expect( act_machine.actions('off').length )
63
- .toBe(1) );
64
-
65
- test('Red has actions()[0] "on" again', () =>
66
- expect( act_machine.actions('off')[0] )
67
- .toBe('on') );
68
-
69
- test('Red has actions().length 1 re-again', () =>
70
- expect( act_machine.actions('red').length )
71
- .toBe(1) );
72
-
73
- test('Red has actions()[0] "off" re-again', () =>
74
- expect( act_machine.actions('red')[0] )
75
- .toBe('off') );
76
-
77
- });
78
-
79
-
80
-
81
-
82
-
83
- describe('States having actions', () => {
84
-
85
- const sha_machine = new jssm.Machine({
86
- start_states : ['off'],
87
- transitions : [
88
- { from: 'off', to: 'red', action: 'on', kind: 'legal', forced_only: false, main_path: false },
89
- { from: 'red', to: 'off', action: 'off', kind: 'legal', forced_only: false, main_path: false }
90
- ]
91
- });
92
-
93
- test('One action has "on"', () =>
94
- expect( sha_machine.list_states_having_action('on').length )
95
- .toBe(1) );
96
-
97
- test('"on" is had by "off"', () =>
98
- expect( sha_machine.list_states_having_action('on')[0] )
99
- .toBe('off') );
100
-
101
- });
102
-
103
-
104
-
105
-
106
-
107
- describe('List exit actions', () => {
108
-
109
- const lea_machine = new jssm.Machine({
110
- start_states : ['off'],
111
- transitions : [
112
- { from: 'off', to: 'red', action: 'on', kind: 'legal', forced_only: false, main_path: false },
113
- { from: 'red', to: 'off', action: 'off', kind: 'legal', forced_only: false, main_path: false }
114
- ]
115
- });
116
-
117
- test('List exit actions, shows "on" from off as default', () =>
118
- expect( lea_machine.list_exit_actions()[0] )
119
- .toBe('on') );
120
-
121
- test('List exit actions, shows "on" from off', () =>
122
- expect( lea_machine.list_exit_actions('off')[0] )
123
- .toBe('on') );
124
-
125
- test('List exit actions, shows "off" from red', () =>
126
- expect( lea_machine.list_exit_actions('red')[0] )
127
- .toBe('off') );
128
-
129
- });
130
-
131
-
132
-
133
-
134
-
135
- describe('Reports on action edges', () => {
136
-
137
- const roae_machine = new jssm.Machine({
138
- start_states : ['off'],
139
- transitions : [
140
- { name:'turn_on', action:'power_on', from:'off', to:'red', kind: 'legal', forced_only: false, main_path: false }
141
- ]
142
- });
143
-
144
- test('Reports on action edges, that it has', () =>
145
- expect( typeof roae_machine.current_action_edge_for('power_on') )
146
- .toBe('object') );
147
-
148
- test('Reports on action edges, that it doesn\'t have', () =>
149
- expect( () => roae_machine.current_action_edge_for('power_west') )
150
- .toThrow() );
151
-
152
- });
153
-
154
-
155
-
156
-
157
-
158
- describe('Two nodes should be able to have matching edges with differing action labels', () => {
159
-
160
- // const machine = sm`a 'first' -> a; a 'second' -> a;`;
161
-
162
- // test('that it has', () => expect( typeof machine.current_action_edge_for('power_on') ).toBe('object') );
163
- // test('that it doesn\'t have', () => expect( () => machine.current_action_edge_for('power_west') ).toThrow() );
164
-
165
- test.todo('todo - uncomment when #531 is resolved');
166
-
167
- });
@@ -1,72 +0,0 @@
1
-
2
- import { sm } from '../jssm';
3
-
4
-
5
-
6
-
7
-
8
- describe('Arrange', () => {
9
-
10
-
11
-
12
- test('Single arrange', () => {
13
-
14
- expect( () => { const _foo = sm`arrange [a b]; a -> b;`; })
15
- .not.toThrow();
16
-
17
- expect(
18
- sm`arrange [a b]; a -> b;`._arrange_declaration
19
- ).toEqual(
20
- [['a','b']]
21
- );
22
-
23
- });
24
-
25
-
26
-
27
- test('Multiple arrange', () => {
28
-
29
- expect( () => { const _foo = sm`arrange [a b]; a -> b; c -> d; arrange [c d];`; })
30
- .not.toThrow();
31
-
32
- expect(
33
- sm`arrange [a b]; a -> b; c -> d; arrange [c d];`._arrange_declaration
34
- ).toEqual(
35
- [['a','b'],['c','d']]
36
- );
37
-
38
- });
39
-
40
-
41
-
42
- test('start', () => {
43
-
44
- expect( () => { const _foo = sm`arrange-start [a c]; a -> b -> c -> d;`; })
45
- .not.toThrow();
46
-
47
- expect(
48
- sm`arrange-start [a c]; a -> b -> c -> d;`._arrange_start_declaration
49
- ).toEqual(
50
- [['a','c']]
51
- );
52
-
53
- });
54
-
55
-
56
-
57
- test('end', () => {
58
-
59
- expect( () => { const _foo = sm`arrange-end [a c]; a -> b -> c -> d;`; })
60
- .not.toThrow();
61
-
62
- expect(
63
- sm`arrange-end [b d]; a -> b -> c -> d;`._arrange_end_declaration
64
- ).toEqual(
65
- [['b','d']]
66
- );
67
-
68
- });
69
-
70
-
71
-
72
- });
@@ -1,4 +0,0 @@
1
-
2
- // import { sm } from '../jssm';
3
-
4
- test('TODO placeholder', () => { expect(1).toBe(1); });