-
Notifications
You must be signed in to change notification settings - Fork 42
/
shared-error.base.native.js
48 lines (42 loc) · 1.23 KB
/
shared-error.base.native.js
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
import React from "react";
import TestRenderer from "react-test-renderer";
import { iterator } from "@times-components/test-utils";
import ArticleListPageError from "../src/article-list-page-error";
import ArticleList from "../src/article-list";
import articlesFixture from "../fixtures/articles.json";
jest.mock("@times-components/button", () => "Button");
jest.mock("../src/article-list-item", () => ({ article }) => {
if (article && article.id === "4e6894ec-cb18-11e7-b529-95e3fc05f40f") {
throw new Error("test");
}
return "ArticleListItem";
});
export default () => {
const tests = [
{
name: "page error",
test() {
const testInstance = TestRenderer.create(
<ArticleListPageError refetch={() => {}} />
);
expect(testInstance).toMatchSnapshot();
}
},
{
name: "article list",
test() {
const testInstance = TestRenderer.create(
<ArticleList
articles={articlesFixture.slice(0, 2)}
emptyStateMessage="Empty state"
onArticlePress={() => {}}
pageSize={3}
refetch={() => {}}
/>
);
expect(testInstance).toMatchSnapshot();
}
}
];
iterator(tests);
};