@@ -297,6 +297,22 @@ describe('Tile', function () {
297
297
} ) ;
298
298
} ) ;
299
299
300
+ it ( 'Valid id parameter value passes' , function ( ) {
301
+ assert . doesNotThrow ( function ( ) {
302
+ sharp ( ) . tile ( {
303
+ id : 'test'
304
+ } ) ;
305
+ } ) ;
306
+ } ) ;
307
+
308
+ it ( 'Invalid id parameter value fails' , function ( ) {
309
+ assert . throws ( function ( ) {
310
+ sharp ( ) . tile ( {
311
+ id : true
312
+ } ) ;
313
+ } ) ;
314
+ } ) ;
315
+
300
316
it ( 'Deep Zoom layout' , function ( done ) {
301
317
const directory = fixtures . path ( 'output.dzi_files' ) ;
302
318
rimraf ( directory , function ( ) {
@@ -815,11 +831,14 @@ describe('Tile', function () {
815
831
} ) ;
816
832
817
833
it ( 'IIIF layout' , function ( done ) {
818
- const directory = fixtures . path ( 'output.iiif.info' ) ;
834
+ const name = 'output.iiif.info' ;
835
+ const directory = fixtures . path ( name ) ;
819
836
rimraf ( directory , function ( ) {
837
+ const id = 'https://sharp.test.com/iiif' ;
820
838
sharp ( fixtures . inputJpg )
821
839
. tile ( {
822
- layout : 'iiif'
840
+ layout : 'iiif' ,
841
+ id
823
842
} )
824
843
. toFile ( directory , function ( err , info ) {
825
844
if ( err ) throw err ;
@@ -828,6 +847,8 @@ describe('Tile', function () {
828
847
assert . strictEqual ( 2225 , info . height ) ;
829
848
assert . strictEqual ( 3 , info . channels ) ;
830
849
assert . strictEqual ( 'number' , typeof info . size ) ;
850
+ const infoJson = require ( path . join ( directory , 'info.json' ) ) ;
851
+ assert . strictEqual ( `${ id } /${ name } ` , infoJson [ '@id' ] ) ;
831
852
fs . stat ( path . join ( directory , '0,0,256,256' , '256,' , '0' , 'default.jpg' ) , function ( err , stat ) {
832
853
if ( err ) throw err ;
833
854
assert . strictEqual ( true , stat . isFile ( ) ) ;
0 commit comments