Skip to content

Commit abd6e7c

Browse files
committed
Add test
1 parent 04a5881 commit abd6e7c

File tree

4 files changed

+46
-3
lines changed

4 files changed

+46
-3
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from "react";
2+
import { webViewRender } from "react-native-react-bridge/lib/web";
3+
import Comp from "./Component";
4+
import data from "./example.json";
5+
6+
alert(data);
7+
8+
const App = () => {
9+
return <Comp />;
10+
};
11+
12+
export default webViewRender(App);

fixtures/example.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"num": 123,
3+
"str": "test"
4+
}

src/plugin/__snapshots__/metro.spec.js.snap

Lines changed: 20 additions & 1 deletion
Large diffs are not rendered by default.

src/plugin/metro.spec.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,25 @@ import * as fs from "fs";
22
import * as path from "path";
33
import { bundle } from "./metro";
44

5-
const resolvePath = (filename) => path.join(__dirname, "../../fixtures", filename);
5+
const resolvePath = (filename) =>
6+
path.join(__dirname, "../../fixtures", filename);
67

78
describe("bundle", () => {
89
beforeEach(() => {
910
jest.setTimeout(30000);
1011
});
1112

12-
it("webViewRender(App)", async () => {
13+
it("default", async () => {
1314
const filename = "app-export-default.jsx";
1415
const filePath = resolvePath(filename);
1516
const res = await bundle(filePath);
1617
expect(res).toMatchSnapshot();
1718
});
19+
20+
it("with json", async () => {
21+
const filename = "app-export-default-with-json.jsx";
22+
const filePath = resolvePath(filename);
23+
const res = await bundle(filePath);
24+
expect(res).toMatchSnapshot();
25+
});
1826
});

0 commit comments

Comments
 (0)