@@ -33,7 +33,7 @@ test('Interlace action validate', () => {
33
33
} ) ;
34
34
35
35
36
- test ( 'quality action ' , async ( ) => {
36
+ test ( 'interlace,1 ' , async ( ) => {
37
37
const image = sharp ( ( await fixtureStore . get ( 'example.jpg' ) ) . buffer ) ;
38
38
const ctx : IImageContext = { image, bufferStore : fixtureStore , features : { } } ;
39
39
const action = new InterlaceAction ( ) ;
@@ -43,11 +43,24 @@ test('quality action', async () => {
43
43
} ) ;
44
44
45
45
46
- test ( 'quality action ' , async ( ) => {
46
+ test ( 'interlace,0 ' , async ( ) => {
47
47
const image = sharp ( ( await fixtureStore . get ( 'example.jpg' ) ) . buffer ) ;
48
48
const ctx : IImageContext = { image, bufferStore : fixtureStore , features : { } } ;
49
49
const action = new InterlaceAction ( ) ;
50
50
await action . process ( ctx , 'interlace,0' . split ( ',' ) ) ;
51
51
const { info } = await ctx . image . toBuffer ( { resolveWithObject : true } ) ;
52
52
expect ( info . format ) . toBe ( sharp . format . jpeg . id ) ;
53
+ } ) ;
54
+
55
+ test ( 'interlace,1 for gif' , async ( ) => {
56
+ const image = sharp ( ( await fixtureStore . get ( 'example.gif' ) ) . buffer , { animated : true } ) ;
57
+ const ctx : IImageContext = { image, bufferStore : fixtureStore , features : { } } ;
58
+ const action = new InterlaceAction ( ) ;
59
+ await action . process ( ctx , 'interlace,1' . split ( ',' ) ) ;
60
+ const { data, info } = await ctx . image . toBuffer ( { resolveWithObject : true } ) ;
61
+
62
+ expect ( info . format ) . toBe ( sharp . format . gif . id ) ;
63
+
64
+ const metadata = await sharp ( data , { animated : true } ) . metadata ( ) ;
65
+ expect ( metadata . pages ) . toBe ( 3 ) ;
53
66
} ) ;
0 commit comments