javascript Card.test.js
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript Card.test.js相关的知识,希望对你有一定的参考价值。
import "react-native";
import React from "react";
import { Text } from "react-native";
import renderer from "react-test-renderer";
import Card from "components/Card";
const mockCustomContainerStyles = { width: 200 };
test("renders correctly with no props passed", () => {
const wrapper = renderer.create(<Card />).toJSON();
expect(wrapper).toMatchSnapshot();
});
test("renders correctly with one child passed", () => {
const wrapper = renderer
.create(
<Card>
<Text>Hello!</Text>
</Card>
)
.toJSON();
expect(wrapper).toMatchSnapshot();
});
test("renders correctly with more children passed", () => {
const wrapper = renderer
.create(
<Card>
<Text>Hello!</Text>
<Text>World!</Text>
</Card>
)
.toJSON();
expect(wrapper).toMatchSnapshot();
});
test("renders correctly with all props passed", () => {
const wrapper = renderer.create(
<Card customContainerStyles={mockCustomContainerStyles}>
<Text>Hello!</Text>
<Text>World!</Text>
</Card>
);
});
以上是关于javascript Card.test.js的主要内容,如果未能解决你的问题,请参考以下文章
javascript的题。
javascript JavaScript isset()等效: - JavaScript
JavaScript 使用JavaScript更改CSS(JavaScript)
JavaScript之基础-1 JavaScript(概述基础语法)
前端基础-JavaScript的基本概述和语法
JavaScript