Skip to content

Commit 22cdf7b

Browse files
star-hamstershenzhiqing
authored andcommitted
feat(result): 增加jest测试 (#404)
Co-authored-by: shenzhiqing <shenzhiqing@nihaosi.com>
1 parent bcc18a6 commit 22cdf7b

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

test-ci/src/__tests__/result.tsx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* @format
3+
*/
4+
5+
import 'react-native';
6+
import React from 'react';
7+
import Result from '../lib/Result';
8+
import Icon from '../lib/Icon';
9+
import Del from '../lib/Typography/S';
10+
import { Text } from 'react-native';
11+
// Note: test renderer must be required after react-native.
12+
import renderer from 'react-test-renderer';
13+
14+
it('Result', () => {
15+
// const component = TestRenderer.create(<Radio value="1">Radio</Radio>);
16+
const component = renderer.create(
17+
<Result
18+
img={<Icon name="pay-circle-o" size={60} fill="#008EF0" />}
19+
title="支付成功"
20+
message={
21+
<Text>
22+
998.00元 <Del>1098元</Del>
23+
</Text>
24+
}
25+
/>,
26+
);
27+
expect(component.root.props.img).toStrictEqual(<Icon name="pay-circle-o" size={60} fill="#008EF0" />);
28+
expect(component.root.props.title).toBe('支付成功');
29+
expect(component.root.props.message).toStrictEqual(
30+
<Text>
31+
998.00元 <Del>1098元</Del>
32+
</Text>,
33+
);
34+
});

0 commit comments

Comments
 (0)