Skip to content

Commit 899e5e7

Browse files
author
Lucas Araujo
committed
[DDW-942] Refactor test mock data
1 parent ee2b22b commit 899e5e7

File tree

1 file changed

+35
-37
lines changed

1 file changed

+35
-37
lines changed

source/renderer/app/components/assets/Asset.spec.tsx

Lines changed: 35 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,67 +5,65 @@ import '@testing-library/jest-dom';
55
import Asset from './Asset';
66
import { TestDecorator } from '../../../../../tests/_utils/TestDecorator';
77

8-
const assets = [
9-
{
10-
policyId: 'policyId',
11-
assetName: '54657374636f696e',
12-
quantity: new BigNumber(1),
13-
fingerprint: 'fingerprint',
14-
metadata: {
15-
name: 'Testcoin',
16-
description: 'Test coin',
17-
},
18-
uniqueId: 'uniqueId',
19-
decimals: 1,
20-
recommendedDecimals: null,
8+
const assetWithMetadataName = {
9+
policyId: 'policyId',
10+
assetName: '54657374636f696e',
11+
quantity: new BigNumber(1),
12+
fingerprint: 'fingerprint',
13+
metadata: {
14+
name: 'Testcoin',
15+
description: 'Test coin',
2116
},
22-
{
23-
policyId: 'policyId',
24-
assetName: '436f696e74657374',
25-
quantity: new BigNumber(1),
26-
fingerprint: 'fingerprint',
27-
uniqueId: 'uniqueId',
28-
decimals: 1,
29-
recommendedDecimals: null,
30-
},
31-
{
32-
policyId: 'policyId',
33-
assetName: '',
34-
quantity: new BigNumber(1),
35-
fingerprint: 'fingerprint',
36-
uniqueId: 'uniqueId',
37-
decimals: 1,
38-
recommendedDecimals: null,
39-
},
40-
];
17+
uniqueId: 'uniqueId',
18+
decimals: 1,
19+
recommendedDecimals: null,
20+
};
21+
const assetWitoutMetadataName = {
22+
policyId: 'policyId',
23+
assetName: '436f696e74657374',
24+
quantity: new BigNumber(1),
25+
fingerprint: 'fingerprint',
26+
uniqueId: 'uniqueId',
27+
decimals: 1,
28+
recommendedDecimals: null,
29+
};
30+
const assetWithoutName = {
31+
policyId: 'policyId',
32+
assetName: '',
33+
quantity: new BigNumber(1),
34+
fingerprint: 'fingerprint',
35+
uniqueId: 'uniqueId',
36+
decimals: 1,
37+
recommendedDecimals: null,
38+
};
4139

4240
describe('Asset', () => {
4341
afterEach(cleanup);
4442

4543
test('Should display asset metadata name', () => {
4644
render(
4745
<TestDecorator>
48-
<Asset asset={assets[0]} />
46+
<Asset asset={assetWithMetadataName} />
4947
</TestDecorator>
5048
);
5149
expect(screen.queryByTestId('assetName')).toHaveTextContent('Testcoin');
5250
});
5351

54-
test('Should display asset ASCII name', () => {
52+
test('Should display asset ASCII name when metadata name is not available', () => {
5553
render(
5654
<TestDecorator>
57-
<Asset asset={assets[1]} />
55+
<Asset asset={assetWitoutMetadataName} />
5856
</TestDecorator>
5957
);
6058
expect(screen.queryByTestId('assetName')).toHaveTextContent(
6159
'ASCII: Cointest'
6260
);
6361
});
6462

65-
test('Should display empty name', () => {
63+
test('Should not display asset name when metadata and ASCII name are not available', () => {
6664
render(
6765
<TestDecorator>
68-
<Asset asset={assets[2]} />
66+
<Asset asset={assetWithoutName} />
6967
</TestDecorator>
7068
);
7169
expect(screen.queryByTestId('assetName')).toBeNull();

0 commit comments

Comments
 (0)