Skip to content

Commit

Permalink
chore: Chore/update png mock for tests (#12975)
Browse files Browse the repository at this point in the history
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

This PR updates the png mock used in tests to return a number, which is
the type that React Native returns when assets are required. All of the
changes in this PR are snapshot updates

## **Related issues**

Fixes:

## **Manual testing steps**

Unit tests should all pass

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
  • Loading branch information
Cal-L authored Jan 15, 2025
1 parent 34f0a55 commit 00bc6d3
Show file tree
Hide file tree
Showing 79 changed files with 173 additions and 1,007 deletions.
4 changes: 3 additions & 1 deletion app/__mocks__/pngMock.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export default { uri: 'MockImage' };
// When required, assets in React Native returns a number
// eslint-disable-next-line import/no-commonjs
module.exports = 1;
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@

exports[`Badge should render badge network given the badge network variant 1`] = `
<BadgeNetwork
imageSource={
{
"default": {
"uri": "MockImage",
},
}
}
imageSource={1}
isScaled={true}
name="Ethereum"
testID="badge-badgenetwork"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,7 @@ exports[`BadgeNetwork should render BadgeNetwork 1`] = `
<Image
onError={[Function]}
resizeMode="contain"
source={
{
"default": {
"uri": "MockImage",
},
}
}
source={1}
style={
{
"height": 32,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,7 @@ exports[`BadgeWrapper should render BadgeWrapper correctly 1`] = `
}
>
<Badge
imageSource={
{
"default": {
"uri": "MockImage",
},
}
}
imageSource={1}
isScaled={true}
name="Ethereum"
variant="network"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@ exports[`BannerTip should render default settings correctly 1`] = `
>
<Image
resizeMode="contain"
source={
{
"uri": "MockImage",
}
}
source={1}
style={
{
"height": 55,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,7 @@ exports[`AccountFromToInfoCard should match snapshot 1`] = `
<Image
onError={[Function]}
resizeMode="contain"
source={
{
"default": {
"uri": "MockImage",
},
}
}
source={1}
style={
{
"height": 32,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,13 +543,7 @@ exports[`AccountRightButton should render correctly 1`] = `
<Image
onError={[Function]}
resizeMode="contain"
source={
{
"default": {
"uri": "MockImage",
},
}
}
source={1}
style={
{
"height": 32,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,7 @@ exports[`Balance should render correctly with a fiat balance 1`] = `
<Image
onError={[Function]}
resizeMode="contain"
source={
{
"uri": "MockImage",
}
}
source={1}
style={
{
"height": 32,
Expand Down Expand Up @@ -376,11 +372,7 @@ exports[`Balance should render correctly without a fiat balance 1`] = `
<Image
onError={[Function]}
resizeMode="contain"
source={
{
"uri": "MockImage",
}
}
source={1}
style={
{
"height": 32,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1056,11 +1056,7 @@ exports[`AssetOverview should render correctly 1`] = `
<Image
onError={[Function]}
resizeMode="contain"
source={
{
"uri": "MockImage",
}
}
source={1}
style={
{
"height": 32,
Expand Down Expand Up @@ -2190,13 +2186,7 @@ exports[`AssetOverview should render correctly when portfolio view is enabled 1`
<Image
onError={[Function]}
resizeMode="contain"
source={
{
"default": {
"uri": "MockImage",
},
}
}
source={1}
style={
{
"height": 32,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,7 @@ exports[`BiometryButton should render correctly 1`] = `
onPress={[Function]}
>
<Image
source={
{
"default": {
"uri": "MockImage",
},
}
}
source={1}
style={
{
"height": 24,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ exports[`CollectibleModal should render correctly 1`] = `
onError={[Function]}
source={
{
"uri": "MockImage",
"uri": "",
}
}
style={
Expand Down
16 changes: 2 additions & 14 deletions app/components/UI/DrawerView/__snapshots__/index.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,7 @@ exports[`DrawerView should render correctly 1`] = `
>
<Image
resizeMethod="auto"
source={
{
"default": {
"uri": "MockImage",
},
}
}
source={1}
style={
{
"height": 27,
Expand All @@ -58,13 +52,7 @@ exports[`DrawerView should render correctly 1`] = `
/>
<Image
resizeMethod="auto"
source={
{
"default": {
"uri": "MockImage",
},
}
}
source={1}
style={
{
"height": 18,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,13 +398,7 @@ exports[`EnableAutomaticSecurityChecksModal should render correctly 1`] = `
testID="enable-automatic-checks-screen-container-image"
>
<Image
source={
{
"default": {
"uri": "MockImage",
},
}
}
source={1}
/>
</View>
<Text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,7 @@ exports[`FoxLoader renders correctly and matches snapshot 1`] = `
>
<Image
resizeMode="contain"
source={
{
"default": {
"uri": "MockImage",
},
}
}
source={1}
style={
{
"height": 72,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,7 @@ exports[`FoxScreen should render correctly 1`] = `
>
<Image
resizeMethod="auto"
source={
{
"default": {
"uri": "MockImage",
},
}
}
source={1}
style={
{
"height": 100,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

exports[`ImageIcon should render correctly 1`] = `
<Image
source={
{
"uri": "MockImage",
}
}
source={1}
style={{}}
/>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ exports[`OpenETHAppStep matches snapshot 1`] = `
[
<Image
resizeMode="contain"
source={
{
"uri": "MockImage",
}
}
source={1}
style={
{
"height": 54,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ exports[`SearchingForDeviceStep matches snapshot for Android < 12 1`] = `
>
<Image
resizeMode="contain"
source={
{
"uri": "MockImage",
}
}
source={1}
style={
{
"height": 54,
Expand Down Expand Up @@ -218,11 +214,7 @@ exports[`SearchingForDeviceStep matches snapshot for Android 12+ 1`] = `
>
<Image
resizeMode="contain"
source={
{
"uri": "MockImage",
}
}
source={1}
style={
{
"height": 54,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@ exports[`LedgerConfirmationModal render matches latest snapshot 1`] = `
>
<Image
resizeMode="contain"
source={
{
"uri": "MockImage",
}
}
source={1}
style={
{
"height": 54,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,11 +416,7 @@ exports[`LedgerMessageSignModal should render correctly 1`] = `
>
<Image
resizeMode="contain"
source={
{
"uri": "MockImage",
}
}
source={1}
style={
{
"height": 54,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ exports[`NetworkCell should render correctly 1`] = `
<TouchableOpacity
avatarProps={
{
"imageSource": {
"uri": "MockImage",
},
"imageSource": 1,
"name": "Ethereum Main Network",
"variant": "Network",
}
Expand Down Expand Up @@ -49,11 +47,7 @@ exports[`NetworkCell should render correctly 1`] = `
<Image
onError={[Function]}
resizeMode="contain"
source={
{
"uri": "MockImage",
}
}
source={1}
style={
{
"height": 32,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,7 @@ exports[`NetworkDetails renders correctly 1`] = `
<Image
onError={[Function]}
resizeMode="contain"
source={
{
"default": {
"uri": "MockImage",
},
}
}
source={1}
style={
{
"height": 16,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,7 @@ exports[`NetworkVerificationInfo renders correctly 1`] = `
<Image
onError={[Function]}
resizeMode="contain"
source={
{
"default": {
"uri": "MockImage",
},
}
}
source={1}
style={
{
"height": 16,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ exports[`NotificationIcon matches snapshot when icon is provided 1`] = `
}
source={
{
"uri": "MockImage",
"uri": "",
}
}
style={
Expand Down
Loading

0 comments on commit 00bc6d3

Please sign in to comment.