@@ -34,10 +34,7 @@ async function createIxFromStream(lines: string[]): Promise<string> {
3434
3535describe ( 'makeIx' , ( ) => {
3636 test ( 'creates index from file' , async ( ) => {
37- const result = await createIx ( [
38- 'id1 apple banana' ,
39- 'id2 cherry date' ,
40- ] )
37+ const result = await createIx ( [ 'id1 apple banana' , 'id2 cherry date' ] )
4138 expect ( result ) . toContain ( 'apple' )
4239 expect ( result ) . toContain ( 'banana' )
4340 expect ( result ) . toContain ( 'cherry' )
@@ -52,21 +49,14 @@ describe('makeIx', () => {
5249 } )
5350
5451 test ( 'sorts output alphabetically' , async ( ) => {
55- const result = await createIx ( [
56- 'id1 zebra' ,
57- 'id2 apple' ,
58- 'id3 middle' ,
59- ] )
52+ const result = await createIx ( [ 'id1 zebra' , 'id2 apple' , 'id3 middle' ] )
6053 const lines = result . trim ( ) . split ( '\n' )
6154 const words = lines . map ( l => l . split ( ' ' ) [ 0 ] )
6255 expect ( words ) . toEqual ( words . toSorted ( ) )
6356 } )
6457
6558 test ( 'groups same words with different ids' , async ( ) => {
66- const result = await createIx ( [
67- 'id1 common unique1' ,
68- 'id2 common unique2' ,
69- ] )
59+ const result = await createIx ( [ 'id1 common unique1' , 'id2 common unique2' ] )
7060 const lines = result . trim ( ) . split ( '\n' )
7161 const commonLine = lines . find ( l => l . startsWith ( 'common' ) )
7262 expect ( commonLine ) . toBeDefined ( )
@@ -87,10 +77,7 @@ describe('makeIx', () => {
8777
8878describe ( 'makeIxStream' , ( ) => {
8979 test ( 'creates index from stream' , async ( ) => {
90- const result = await createIxFromStream ( [
91- 'id1 hello world' ,
92- 'id2 foo bar' ,
93- ] )
80+ const result = await createIxFromStream ( [ 'id1 hello world' , 'id2 foo bar' ] )
9481 expect ( result ) . toContain ( 'hello' )
9582 expect ( result ) . toContain ( 'world' )
9683 expect ( result ) . toContain ( 'foo' )
0 commit comments