@@ -300,6 +300,61 @@ describe('.layers', () => {
300300 expect ( layers . length ) . toEqual ( 1 ) ;
301301 expect ( layers [ 0 ] . paths . length ) . toEqual ( 4 ) ;
302302 } ) ;
303+
304+ test ( 'layer z must equal path z' , ( ) => {
305+ const job = new Job ( ) ;
306+
307+ append_path ( job , PathType . Extrusion , [
308+ [ 5 , 6 , 2 ] ,
309+ [ 5 , 6 , 2 ]
310+ ] ) ;
311+
312+ const layers = job . layers ;
313+
314+ expect ( layers ) . not . toBeNull ( ) ;
315+ expect ( layers . length ) . toEqual ( 1 ) ;
316+ expect ( layers [ 0 ] . z ) . toEqual ( 2 ) ;
317+ } ) ;
318+
319+ test ( 'layer z must equal extrusion path z' , ( ) => {
320+ const job = new Job ( ) ;
321+
322+ append_path ( job , PathType . Extrusion , [
323+ [ 5 , 6 , 2 ] ,
324+ [ 5 , 6 , 2 ]
325+ ] ) ;
326+
327+ append_path ( job , PathType . Travel , [
328+ [ 5 , 6 , 4 ] ,
329+ [ 5 , 6 , 4 ]
330+ ] ) ;
331+
332+ const layers = job . layers ;
333+
334+ expect ( layers ) . not . toBeNull ( ) ;
335+ expect ( layers . length ) . toEqual ( 1 ) ;
336+ expect ( layers [ 0 ] . z ) . toEqual ( 2 ) ;
337+ } ) ;
338+
339+
340+ test ( 'layer z must equal path z, for second layer' , ( ) => {
341+ const job = new Job ( ) ;
342+
343+ append_path ( job , PathType . Extrusion , [
344+ [ 5 , 6 , 2 ] ,
345+ [ 5 , 6 , 2 ]
346+ ] ) ;
347+ append_path ( job , PathType . Extrusion , [
348+ [ 5 , 6 , 4 ] ,
349+ [ 5 , 6 , 4 ]
350+ ] ) ;
351+
352+ const layers = job . layers ;
353+
354+ expect ( layers ) . not . toBeNull ( ) ;
355+ expect ( layers . length ) . toEqual ( 2 ) ;
356+ expect ( layers [ 1 ] . z ) . toEqual ( 4 ) ;
357+ } ) ;
303358} ) ;
304359
305360describe ( '.extrusions' , ( ) => {
0 commit comments