Skip to content

Commit 18356f3

Browse files
committed
fix(tests): set mocked state
1 parent 8e38168 commit 18356f3

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

source/app/metrics/utils.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ export async function imgb64(image, {width, height, fallback = true} = {}) {
332332
//Load image
333333
try {
334334
//Fix: redirections are not properly supported by jimp (https://github.com/oliver-moran/jimp/issues/909), seems to occur only when in jest environment
335-
if ((typeof image === "string") && (process.env.JEST_WORKER_ID)) {
335+
if ((typeof image === "string") && ((process.env.JEST_WORKER_ID)||(process.env.METRICS_MOCKED))) {
336336
image = (await axios.get(image)).then(response => response.request.responseURL).catch(() => null)
337337
console.debug(`metrics/svg/imgb64 > redirected image link to ${image}`)
338338
}

tests/mocks/index.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import urls from "url"
88

99
//Mocked state
1010
let mocked = false
11+
process.env.METRICS_MOCKED = true
1112

1213
//Mocking
1314
export default async function({graphql, rest}) {

0 commit comments

Comments
 (0)