@@ -35,7 +35,11 @@ describe("libnut screen action", () => {
3535 bytesPerPixel : 0 ,
3636 colorAt : jest . fn ( ) ,
3737 height : screenShotSize . height ,
38- image : new ArrayBuffer ( 0 ) ,
38+ image : Buffer . from (
39+ new Array ( screenShotSize . width * screenShotSize . height * 4 + 10 ) . fill (
40+ 0
41+ )
42+ ) ,
3943 width : screenShotSize . width ,
4044 } ) ) ;
4145 libnut . getScreenSize = jest . fn ( ( ) => ( {
@@ -51,6 +55,9 @@ describe("libnut screen action", () => {
5155 expect ( image . height ) . toEqual ( screenShotSize . height ) ;
5256 expect ( image . pixelDensity . scaleX ) . toEqual ( 2 ) ;
5357 expect ( image . pixelDensity . scaleY ) . toEqual ( 2 ) ;
58+ expect ( image . data . length ) . toEqual (
59+ screenShotSize . width * screenShotSize . height * 4
60+ ) ;
5461 expect ( libnut . screen . capture ) . toBeCalledTimes ( 1 ) ;
5562 } ) ;
5663
@@ -64,7 +71,11 @@ describe("libnut screen action", () => {
6471 bytesPerPixel : 0 ,
6572 colorAt : jest . fn ( ) ,
6673 height : screenShotSize . height ,
67- image : new ArrayBuffer ( 0 ) ,
74+ image : Buffer . from (
75+ new Array ( screenShotSize . width * screenShotSize . height * 4 + 10 ) . fill (
76+ 0
77+ )
78+ ) ,
6879 width : screenShotSize . width ,
6980 } ) ) ;
7081
@@ -76,6 +87,9 @@ describe("libnut screen action", () => {
7687 expect ( image . height ) . toEqual ( screenShotSize . height ) ;
7788 expect ( image . pixelDensity . scaleX ) . toEqual ( 20 ) ;
7889 expect ( image . pixelDensity . scaleY ) . toEqual ( 20 ) ;
90+ expect ( image . data . length ) . toEqual (
91+ screenShotSize . width * screenShotSize . height * 4
92+ ) ;
7993 expect ( libnut . screen . capture ) . toBeCalledTimes ( 1 ) ;
8094 } ) ;
8195
0 commit comments