@@ -14,6 +14,8 @@ dotenv.config({ path: '.env.test' })
1414const { imgProxyURL, jwtSecret } = getConfig ( )
1515let appInstance : FastifyInstance
1616
17+ const projectRoot = path . join ( __dirname , '..' , '..' )
18+
1719describe ( 'image rendering routes' , ( ) => {
1820 beforeAll ( async ( ) => {
1921 await fs . mkdir ( path . join ( __dirname , '..' , '..' , 'data' ) , { recursive : true } )
@@ -51,7 +53,7 @@ describe('image rendering routes', () => {
5153 expect ( response . statusCode ) . toBe ( 200 )
5254 expect ( S3Backend . prototype . privateAssetUrl ) . toBeCalledTimes ( 1 )
5355 expect ( axiosSpy ) . toBeCalledWith (
54- ' /public/height:100/width:100/resizing_type:fill/plain/local:///data/sadcat.jpg' ,
56+ ` /public/height:100/width:100/resizing_type:fill/plain/local:///${ projectRoot } / data/sadcat.jpg` ,
5557 { responseType : 'stream' , signal : expect . any ( AbortSignal ) }
5658 )
5759 } )
@@ -69,7 +71,7 @@ describe('image rendering routes', () => {
6971 expect ( response . statusCode ) . toBe ( 200 )
7072 expect ( S3Backend . prototype . privateAssetUrl ) . toBeCalledTimes ( 1 )
7173 expect ( axiosSpy ) . toBeCalledWith (
72- ' /public/height:100/width:100/resizing_type:fill/plain/local:///data/sadcat.jpg' ,
74+ ` /public/height:100/width:100/resizing_type:fill/plain/local:///${ projectRoot } / data/sadcat.jpg` ,
7375 { responseType : 'stream' , signal : expect . any ( AbortSignal ) }
7476 )
7577 } )
@@ -112,7 +114,7 @@ describe('image rendering routes', () => {
112114 expect ( response . statusCode ) . toBe ( 200 )
113115 expect ( S3Backend . prototype . privateAssetUrl ) . toBeCalledTimes ( 1 )
114116 expect ( axiosSpy ) . toBeCalledWith (
115- ' /public/height:100/width:100/resizing_type:fit/plain/local:///data/sadcat.jpg' ,
117+ ` /public/height:100/width:100/resizing_type:fit/plain/local:///${ projectRoot } / data/sadcat.jpg` ,
116118 { responseType : 'stream' , signal : expect . any ( AbortSignal ) }
117119 )
118120 } )
@@ -159,7 +161,7 @@ describe('image rendering routes', () => {
159161 expect ( response . statusCode ) . toBe ( 200 )
160162 expect ( S3Backend . prototype . privateAssetUrl ) . toBeCalledTimes ( 1 )
161163 expect ( axiosSpy ) . toBeCalledWith (
162- ' /public/height:100/width:100/resizing_type:fit/plain/local:///data/sadcat.jpg' ,
164+ ` /public/height:100/width:100/resizing_type:fit/plain/local:///${ projectRoot } / data/sadcat.jpg` ,
163165 { responseType : 'stream' , signal : expect . any ( AbortSignal ) }
164166 )
165167 } )
0 commit comments