@@ -14,6 +14,8 @@ dotenv.config({ path: '.env.test' })
14
14
const { imgProxyURL, jwtSecret } = getConfig ( )
15
15
let appInstance : FastifyInstance
16
16
17
+ const projectRoot = path . join ( __dirname , '..' , '..' )
18
+
17
19
describe ( 'image rendering routes' , ( ) => {
18
20
beforeAll ( async ( ) => {
19
21
await fs . mkdir ( path . join ( __dirname , '..' , '..' , 'data' ) , { recursive : true } )
@@ -51,7 +53,7 @@ describe('image rendering routes', () => {
51
53
expect ( response . statusCode ) . toBe ( 200 )
52
54
expect ( S3Backend . prototype . privateAssetUrl ) . toBeCalledTimes ( 1 )
53
55
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` ,
55
57
{ responseType : 'stream' , signal : expect . any ( AbortSignal ) }
56
58
)
57
59
} )
@@ -69,7 +71,7 @@ describe('image rendering routes', () => {
69
71
expect ( response . statusCode ) . toBe ( 200 )
70
72
expect ( S3Backend . prototype . privateAssetUrl ) . toBeCalledTimes ( 1 )
71
73
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` ,
73
75
{ responseType : 'stream' , signal : expect . any ( AbortSignal ) }
74
76
)
75
77
} )
@@ -112,7 +114,7 @@ describe('image rendering routes', () => {
112
114
expect ( response . statusCode ) . toBe ( 200 )
113
115
expect ( S3Backend . prototype . privateAssetUrl ) . toBeCalledTimes ( 1 )
114
116
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` ,
116
118
{ responseType : 'stream' , signal : expect . any ( AbortSignal ) }
117
119
)
118
120
} )
@@ -159,7 +161,7 @@ describe('image rendering routes', () => {
159
161
expect ( response . statusCode ) . toBe ( 200 )
160
162
expect ( S3Backend . prototype . privateAssetUrl ) . toBeCalledTimes ( 1 )
161
163
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` ,
163
165
{ responseType : 'stream' , signal : expect . any ( AbortSignal ) }
164
166
)
165
167
} )
0 commit comments