@@ -109,10 +109,31 @@ describe('state-processor/capture-processor/capture-processor', () => {
109109 exec_ = mkExecMethod ( tester ) ;
110110 } ) ;
111111
112- it ( 'should be rejected with "NoRefImageError" if reference image does not exist' , ( ) => {
113- utils . existsRef . resolves ( false ) ;
112+ describe ( 'reference image does not exist' , ( ) => {
113+ beforeEach ( ( ) => {
114+ utils . existsRef . withArgs ( '/non-existent/path' ) . resolves ( false ) ;
115+ } ) ;
116+
117+ it ( 'should save current image to a temporary directory' , ( ) => {
118+ temp . path . withArgs ( { suffix : '.png' } ) . returns ( '/temp/path' ) ;
119+
120+ return exec_ ( { referencePath : '/non-existent/path' } )
121+ . catch ( ( ) => assert . calledOnceWith ( Image . prototype . save , '/temp/path' ) ) ;
122+ } ) ;
114123
115- return assert . isRejected ( exec_ ( { refPath : '/non-existent/path' } ) , NoRefImageError ) ;
124+ it ( 'should be rejected with "NoRefImageError"' , ( ) => {
125+ return assert . isRejected ( exec_ ( { referencePath : '/non-existent/path' } ) , NoRefImageError ) ;
126+ } ) ;
127+
128+ it ( 'should pass reference and current image paths to "NoRefImageError"' , ( ) => {
129+ temp . path . withArgs ( { suffix : '.png' } ) . returns ( '/temp/path' ) ;
130+
131+ return exec_ ( { referencePath : '/non-existent/path' } )
132+ . catch ( ( err ) => {
133+ assert . equal ( err . refImagePath , '/non-existent/path' ) ;
134+ assert . equal ( err . currentPath , '/temp/path' ) ;
135+ } ) ;
136+ } ) ;
116137 } ) ;
117138
118139 describe ( 'should return image comparison result if images are' , ( ) => {
0 commit comments