@@ -6,7 +6,7 @@ import fs from 'fs';
66import { promisify } from 'util' ;
77import { EOL } from 'os' ;
88import { expect } from 'chai' ;
9- import { FIXTURES } from '../../test/fixtures' ;
9+ import { fixtures } from '../../test/fixtures' ;
1010
1111const pipeline = promisify ( stream . pipeline ) ;
1212const readFile = promisify ( fs . readFile ) ;
@@ -26,17 +26,17 @@ describe('formatters', function () {
2626 { _id : new ObjectID ( '5e5ea7558d35931a05eafec0' ) } ,
2727 ] ) ;
2828 const formatter = createJSONFormatter ( { brackets : true } ) ;
29- const dest = fs . createWriteStream ( FIXTURES . JSON_SINGLE_DOC ) ;
29+ const dest = fs . createWriteStream ( fixtures . JSON_SINGLE_DOC ) ;
3030
3131 return pipeline ( source , formatter , dest )
32- . then ( ( ) => readFile ( FIXTURES . JSON_SINGLE_DOC ) )
32+ . then ( ( ) => readFile ( fixtures . JSON_SINGLE_DOC ) )
3333 . then ( ( contents ) => {
3434 const parsed = EJSON . parse ( contents ) ;
3535 expect ( parsed ) . to . deep . equal ( [
3636 { _id : new ObjectID ( '5e5ea7558d35931a05eafec0' ) } ,
3737 ] ) ;
3838 } )
39- . then ( ( ) => rm ( FIXTURES . JSON_SINGLE_DOC ) ) ;
39+ . then ( ( ) => rm ( fixtures . JSON_SINGLE_DOC ) ) ;
4040 } ) ;
4141 it ( 'should format more than 2 documents in an array' , function ( ) {
4242 const docs = [
@@ -46,20 +46,20 @@ describe('formatters', function () {
4646 ] ;
4747 const source = stream . Readable . from ( docs ) ;
4848 const formatter = createJSONFormatter ( { brackets : true } ) ;
49- const dest = fs . createWriteStream ( FIXTURES . JSON_MULTI_SMALL_DOCS ) ;
49+ const dest = fs . createWriteStream ( fixtures . JSON_MULTI_SMALL_DOCS ) ;
5050
5151 return pipeline ( source , formatter , dest )
52- . then ( ( ) => readFile ( FIXTURES . JSON_MULTI_SMALL_DOCS ) )
52+ . then ( ( ) => readFile ( fixtures . JSON_MULTI_SMALL_DOCS ) )
5353 . then ( ( contents ) => {
5454 const parsed = EJSON . parse ( contents ) ;
5555 expect ( parsed ) . to . deep . equal ( docs ) ;
5656 } )
57- . then ( ( ) => rm ( FIXTURES . JSON_MULTI_SMALL_DOCS ) ) ;
57+ . then ( ( ) => rm ( fixtures . JSON_MULTI_SMALL_DOCS ) ) ;
5858 } ) ;
5959 describe ( 'should format binary data correctly' , function ( ) {
6060 afterEach ( async function ( ) {
6161 try {
62- await rm ( FIXTURES . JSON_MULTI_SMALL_DOCS ) ;
62+ await rm ( fixtures . JSON_MULTI_SMALL_DOCS ) ;
6363 } catch ( e ) {
6464 // noop
6565 }
@@ -79,11 +79,11 @@ describe('formatters', function () {
7979 ] ;
8080 const source = stream . Readable . from ( docs ) ;
8181 const formatter = createJSONFormatter ( { brackets : true } ) ;
82- const dest = fs . createWriteStream ( FIXTURES . JSON_MULTI_SMALL_DOCS ) ;
82+ const dest = fs . createWriteStream ( fixtures . JSON_MULTI_SMALL_DOCS ) ;
8383
8484 await pipeline ( source , formatter , dest ) ;
8585
86- const contents = await readFile ( FIXTURES . JSON_MULTI_SMALL_DOCS ) ;
86+ const contents = await readFile ( fixtures . JSON_MULTI_SMALL_DOCS ) ;
8787 const parsed = EJSON . parse ( contents ) ;
8888
8989 expect ( parsed ) . to . deep . equal ( docs ) ;
@@ -93,7 +93,7 @@ describe('formatters', function () {
9393 describe ( 'should format Longs correctly' , function ( ) {
9494 afterEach ( async function ( ) {
9595 try {
96- await rm ( FIXTURES . JSON_MULTI_SMALL_DOCS ) ;
96+ await rm ( fixtures . JSON_MULTI_SMALL_DOCS ) ;
9797 } catch ( e ) {
9898 // noop
9999 }
@@ -110,11 +110,11 @@ describe('formatters', function () {
110110 ] ;
111111 const source = stream . Readable . from ( docs ) ;
112112 const formatter = createJSONFormatter ( { brackets : true } ) ;
113- const dest = fs . createWriteStream ( FIXTURES . JSON_MULTI_SMALL_DOCS ) ;
113+ const dest = fs . createWriteStream ( fixtures . JSON_MULTI_SMALL_DOCS ) ;
114114
115115 await pipeline ( source , formatter , dest ) ;
116116
117- const contents = await readFile ( FIXTURES . JSON_MULTI_SMALL_DOCS ) ;
117+ const contents = await readFile ( fixtures . JSON_MULTI_SMALL_DOCS ) ;
118118 const parsed = EJSON . parse ( contents , { relaxed : false } ) ;
119119
120120 expect ( parsed ) . to . deep . equal ( docs ) ;
@@ -129,17 +129,17 @@ describe('formatters', function () {
129129 ] ;
130130 const source = stream . Readable . from ( docs ) ;
131131 const formatter = createJSONFormatter ( { brackets : false } ) ;
132- const dest = fs . createWriteStream ( FIXTURES . JSONL ) ;
132+ const dest = fs . createWriteStream ( fixtures . JSONL ) ;
133133
134134 return pipeline ( source , formatter , dest )
135- . then ( ( ) => readFile ( FIXTURES . JSONL ) )
135+ . then ( ( ) => readFile ( fixtures . JSONL ) )
136136 . then ( ( buf ) => {
137137 const sources = buf . toString ( 'utf-8' ) . split ( EOL ) ;
138138 expect ( EJSON . parse ( sources [ 0 ] ) ) . to . deep . equal ( docs [ 0 ] ) ;
139139 expect ( EJSON . parse ( sources [ 1 ] ) ) . to . deep . equal ( docs [ 1 ] ) ;
140140 expect ( EJSON . parse ( sources [ 2 ] ) ) . to . deep . equal ( docs [ 2 ] ) ;
141141 } )
142- . then ( ( ) => rm ( FIXTURES . JSONL ) ) ;
142+ . then ( ( ) => rm ( fixtures . JSONL ) ) ;
143143 } ) ;
144144 } ) ;
145145 describe ( 'csv' , function ( ) {
@@ -152,13 +152,13 @@ describe('formatters', function () {
152152 const formatter = createCSVFormatter ( {
153153 columns : [ '_id.foo' ] ,
154154 } ) ;
155- const dest = fs . createWriteStream ( FIXTURES . CSV_FLAT_HEADERS ) ;
155+ const dest = fs . createWriteStream ( fixtures . CSV_FLAT_HEADERS ) ;
156156
157157 return pipeline ( source , formatter , dest )
158- . then ( ( ) => readFile ( FIXTURES . CSV_FLAT_HEADERS ) )
158+ . then ( ( ) => readFile ( fixtures . CSV_FLAT_HEADERS ) )
159159 . then ( ( ) => {
160160 return pipeline (
161- fs . createReadStream ( FIXTURES . CSV_FLAT_HEADERS ) ,
161+ fs . createReadStream ( fixtures . CSV_FLAT_HEADERS ) ,
162162 createCSVParser ( ) ,
163163 new stream . Writable ( {
164164 objectMode : true ,
@@ -169,7 +169,7 @@ describe('formatters', function () {
169169 } )
170170 ) ;
171171 } )
172- . then ( ( ) => rm ( FIXTURES . CSV_FLAT_HEADERS ) ) ;
172+ . then ( ( ) => rm ( fixtures . CSV_FLAT_HEADERS ) ) ;
173173 } ) ;
174174
175175 /**
@@ -179,13 +179,13 @@ describe('formatters', function () {
179179 const docs = [ { _id : new ObjectID ( '5e5ea7558d35931a05eafec0' ) } ] ;
180180 const source = stream . Readable . from ( docs ) ;
181181 const formatter = createCSVFormatter ( { columns : [ '_id' ] } ) ;
182- const dest = fs . createWriteStream ( FIXTURES . CSV_FLAT_HEADERS ) ;
182+ const dest = fs . createWriteStream ( fixtures . CSV_FLAT_HEADERS ) ;
183183
184184 return pipeline ( source , formatter , dest )
185- . then ( ( ) => readFile ( FIXTURES . CSV_FLAT_HEADERS ) )
185+ . then ( ( ) => readFile ( fixtures . CSV_FLAT_HEADERS ) )
186186 . then ( ( ) => {
187187 return pipeline (
188- fs . createReadStream ( FIXTURES . CSV_FLAT_HEADERS ) ,
188+ fs . createReadStream ( fixtures . CSV_FLAT_HEADERS ) ,
189189 createCSVParser ( ) ,
190190 new stream . Writable ( {
191191 objectMode : true ,
@@ -198,7 +198,7 @@ describe('formatters', function () {
198198 } )
199199 ) ;
200200 } )
201- . then ( ( ) => rm ( FIXTURES . CSV_FLAT_HEADERS ) ) ;
201+ . then ( ( ) => rm ( fixtures . CSV_FLAT_HEADERS ) ) ;
202202 } ) ;
203203 } ) ;
204204} ) ;
0 commit comments