@@ -2,6 +2,8 @@ import test from 'ava';
22
33import { list , range , map } from '@aureooms/js-itertools' ;
44
5+ import { str } from './_fixtures.js' ;
6+
57import { from , shift , iter } from '../../src/index.js' ;
68
79function throws ( t , array ) {
@@ -10,7 +12,7 @@ function throws(t, array) {
1012 t . throws ( ( ) => shift ( node ) , { message : / e m p t y / } ) ;
1113}
1214
13- throws . title = ( title , array ) => title || `shift(${ string ( array ) } ) ~> throws` ;
15+ throws . title = ( title , array ) => title || `shift(${ str ( array ) } ) ~> throws` ;
1416
1517function macro ( t , array ) {
1618 const node = from ( array ) ;
@@ -20,14 +22,7 @@ function macro(t, array) {
2022 t . deepEqual ( array . slice ( 1 ) , result ) ;
2123}
2224
23- macro . title = ( title , array ) =>
24- title || `shift(${ string ( array ) } ) ~> ${ array [ 0 ] } ` ;
25-
26- function string ( array ) {
27- const s = JSON . stringify ( array ) ;
28- if ( s <= 40 ) return s ;
29- return s . slice ( 0 , 19 ) + '..' + s . slice ( - 19 ) ;
30- }
25+ macro . title = ( title , array ) => title || `shift(${ str ( array ) } ) ~> ${ array [ 0 ] } ` ;
3126
3227test ( throws , [ ] ) ;
3328test ( macro , [ 27 ] ) ;
0 commit comments