@@ -18,18 +18,21 @@ import DataView64 from '../dist-module/dataview64.js';
18
18
19
19
const __dirname = dirname ( new URL ( import . meta. url ) . pathname ) ;
20
20
21
- // Set up a node server to make tiffs available at localhost:3000/test/data
21
+ // Set up a node server to make tiffs available at localhost:3000/test/data, and a worker pool
22
22
let server = null ;
23
+ let pool = null ;
23
24
before ( async ( ) => {
24
25
const serve = serveStatic ( __dirname ) ;
25
26
server = http . createServer ( ( req , res ) => {
26
27
serve ( req , res , finalhandler ( req , res ) ) ;
27
28
} ) ;
28
29
server . listen ( 3000 ) ;
30
+ pool = new Pool ( ) ;
29
31
} ) ;
30
32
31
33
after ( async ( ) => {
32
34
server . close ( ) ;
35
+ pool . destroy ( ) ;
33
36
} ) ;
34
37
35
38
function createSource ( filename ) {
@@ -256,11 +259,11 @@ describe('GeoTIFF', () => {
256
259
} ) ;
257
260
258
261
it ( 'should work with worker pool' , async ( ) => {
259
- const pool = new Pool ( ) ;
262
+ const testPool = new Pool ( ) ;
260
263
const tiff = await GeoTIFF . fromSource ( createSource ( 'nasa_raster.tiff' ) ) ;
261
264
const image = await tiff . getImage ( ) ;
262
- await image . readRasters ( { pool } ) ;
263
- pool . destroy ( ) ;
265
+ await image . readRasters ( { pool : testPool } ) ;
266
+ testPool . destroy ( ) ;
264
267
} ) ;
265
268
266
269
it ( 'should work with LZW compressed tiffs that have an EOI Code after a CLEAR code' , async ( ) => {
@@ -650,21 +653,21 @@ describe('fillValue', async () => {
650
653
}
651
654
} ) ;
652
655
653
- it ( 'should fill areas in overview tiles outside the image extent (left)' , async ( ) => {
656
+ it ( 'should fill areas in overview tiles outside the image extent (left, with worker pool )' , async ( ) => {
654
657
const tiff = await GeoTIFF . fromSource ( createSource ( 'cog.tiff' ) ) ;
655
658
const image = await tiff . getImage ( 1 ) ;
656
- const data = await image . readRasters ( { window : [ 269 , 0 , 270 , 1 ] , fillValue : 42 } ) ;
659
+ const data = await image . readRasters ( { window : [ 269 , 0 , 270 , 1 ] , fillValue : 42 , pool } ) ;
657
660
expect ( data ) . to . have . lengthOf ( 15 ) ;
658
661
for ( const band of data ) {
659
662
expect ( band ) . to . have . lengthOf ( 1 ) ;
660
663
expect ( band ) . to . deep . equal ( new Uint16Array ( [ 42 ] ) ) ;
661
664
}
662
665
} ) . timeout ( 10000 ) ;
663
666
664
- it ( 'should fill areas in overview tiles outside the image extent (below)' , async ( ) => {
667
+ it ( 'should fill areas in overview tiles outside the image extent (below, with worker pool )' , async ( ) => {
665
668
const tiff = await GeoTIFF . fromSource ( createSource ( 'cog.tiff' ) ) ;
666
669
const image = await tiff . getImage ( 1 ) ;
667
- const data = await image . readRasters ( { window : [ 0 , 224 , 1 , 225 ] , fillValue : 42 } ) ;
670
+ const data = await image . readRasters ( { window : [ 0 , 224 , 1 , 225 ] , fillValue : 42 , pool } ) ;
668
671
expect ( data ) . to . have . lengthOf ( 15 ) ;
669
672
for ( const band of data ) {
670
673
expect ( band ) . to . have . lengthOf ( 1 ) ;
0 commit comments