如何正确地测试反应性组件中的复合字符串子项?

时间:2019-01-10 14:38:31

标签: javascript reactjs react-native jestjs enzyme

我有下一个代码:

import styled from "styled-components/native";

const BaseTitle = styled.Text`
  font-size: 18;
  font-weight: bold;
  color: #111;
`;

function Title({ title }) {
  return <BaseTitle>№{title}</BaseTitle>;
}

如何正确检查应包含字符№的字符串和已传输的字符串?

test("Title render", () => {
  const tree = shallow(<Title title="123123" />);
  expect(?????).toContain("№123123");
});

0 个答案:

没有答案