@@ -64,20 +64,39 @@ describe('gcode-parser', () => {
64
64
} ) ;
65
65
66
66
describe ( 'Commands' , ( ) => {
67
- it ( 'should parse $ commands for Grbl.' , ( done ) => {
67
+ it ( 'should be able to parse $ command (e.g. Grbl) .' , ( done ) => {
68
68
const data = parseLine ( '$H $C' ) ;
69
69
expect ( data ) . to . be . an ( 'object' ) ;
70
70
expect ( data . line ) . to . be . an ( 'string' ) ;
71
71
expect ( data . words ) . to . be . empty ;
72
72
expect ( data . cmds ) . to . deep . equal ( [ '$H' , '$C' ] ) ;
73
73
done ( ) ;
74
74
} ) ;
75
- it ( 'should parse % commands for bCNC and CNCjs.' , ( done ) => {
76
- const data = parseLine ( '%wait' ) ;
77
- expect ( data ) . to . be . an ( 'object' ) ;
78
- expect ( data . line ) . to . be . an ( 'string' ) ;
79
- expect ( data . words ) . to . be . empty ;
80
- expect ( data . cmds ) . to . deep . equal ( [ '%wait' ] ) ;
75
+ it ( 'should be able to parse % command (e.g. bCNC, CNCjs).' , ( done ) => {
76
+ { // %wait
77
+ const data = parseLine ( '%wait' ) ;
78
+ expect ( data ) . to . be . an ( 'object' ) ;
79
+ expect ( data . line ) . to . be . an ( 'string' ) ;
80
+ expect ( data . words ) . to . be . empty ;
81
+ expect ( data . cmds ) . to . deep . equal ( [ '%wait' ] ) ;
82
+ }
83
+
84
+ { // %zsafe=10
85
+ const data = parseLine ( '%zsafe=10' ) ;
86
+ expect ( data ) . to . be . an ( 'object' ) ;
87
+ expect ( data . line ) . to . be . an ( 'string' ) ;
88
+ expect ( data . words ) . to . be . empty ;
89
+ expect ( data . cmds ) . to . deep . equal ( [ '%zsafe=10' ] ) ;
90
+ }
91
+
92
+ { // %x0=posx,y0=posy,z0=posz
93
+ const data = parseLine ( '%x0=posx,y0=posy,z0=posz' ) ;
94
+ expect ( data ) . to . be . an ( 'object' ) ;
95
+ expect ( data . line ) . to . be . an ( 'string' ) ;
96
+ expect ( data . words ) . to . be . empty ;
97
+ expect ( data . cmds ) . to . deep . equal ( [ '%x0=posx,y0=posy,z0=posz' ] ) ;
98
+ }
99
+
81
100
done ( ) ;
82
101
} ) ;
83
102
} ) ;
0 commit comments