-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathContractBoxBase.test.tsx
More file actions
49 lines (44 loc) · 1.48 KB
/
ContractBoxBase.test.tsx
File metadata and controls
49 lines (44 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import React from 'react';
import { screen } from '@testing-library/react-native';
import ContractBoxBase from './ContractBoxBase';
import TEST_ADDRESS from '../../../../constants/address';
import {
CONTRACT_PET_NAME,
CONTRACT_LOCAL_IMAGE,
CONTRACT_COPY_ADDRESS,
CONTRACT_ON_PRESS,
} from '../ContractBox/ContractBox.constants';
import { CONTRACT_BOX_NO_PET_NAME_TEST_ID } from './ContractBoxBase.constants';
import { ContractBoxBaseProps } from './ContractBoxBase.types';
import renderWithProvider from '../../../../util/test/renderWithProvider';
describe('Component ContractBoxBase', () => {
let props: ContractBoxBaseProps;
beforeEach(() => {
props = {
contractAddress: TEST_ADDRESS,
contractPetName: CONTRACT_PET_NAME,
contractLocalImage: CONTRACT_LOCAL_IMAGE,
onCopyAddress: CONTRACT_COPY_ADDRESS,
onContractPress: CONTRACT_ON_PRESS,
};
});
const renderComponent = () =>
renderWithProvider(<ContractBoxBase {...props} />, {
state: {
engine: {
backgroundState: {
PreferencesController: { isIpfsGatewayEnabled: true },
},
},
},
});
it('should render correctly', () => {
const { toJSON } = renderComponent();
expect(toJSON()).toBeDefined();
});
it('renders the no-pet-name element when contractPetName is undefined', () => {
props.contractPetName = undefined;
renderComponent();
expect(screen.getByTestId(CONTRACT_BOX_NO_PET_NAME_TEST_ID)).toBeTruthy();
});
});