Skip to content

Commit

Permalink
fix(📕): added font mock to skia jest setup (#2903)
Browse files Browse the repository at this point in the history
Co-authored-by: William Candillon <[email protected]>
  • Loading branch information
diatche and wcandillon authored Jan 22, 2025
1 parent 99ac0ec commit d029b60
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/skia/jestSetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ jest.mock("@shopify/react-native-skia", () => {
View: Noop,
};
});
jest.mock("@shopify/react-native-skia/lib/commonjs/skia/core/Font", () => {
return {
useFont: () => null,
matchFont: () => null,
listFontFamilies: () => [],
useFonts: () => null,
}
});
return require("@shopify/react-native-skia/lib/commonjs/mock").Mock(
global.CanvasKit
);
Expand Down
8 changes: 8 additions & 0 deletions packages/skia/jestSetup.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,13 @@ jest.mock("@shopify/react-native-skia", () => {
View: Noop,
};
});
jest.mock("@shopify/react-native-skia/lib/commonjs/skia/core/Font", () => {
return {
useFont: () => null,
matchFont: () => null,
listFontFamilies: () => [],
useFonts: () => null,
}
});
return Mock(global.CanvasKit);
});

0 comments on commit d029b60

Please sign in to comment.