Skip to content

Commit c25d61e

Browse files
committed
Add tests for tsx
1 parent 11ea6a0 commit c25d61e

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

fixtures/app-export-default.tsx

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

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

Lines changed: 20 additions & 0 deletions
Large diffs are not rendered by default.

src/plugin/babel.spec.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,11 @@ describe("isEntryFile", () => {
3333
const paths = isEntryFile(src, filename);
3434
expect(paths).toEqual(false);
3535
});
36+
37+
it("export default webViewRender(App) (tsx)", () => {
38+
const filename = "app-export-default.tsx";
39+
const src = readFixture(filename);
40+
const paths = isEntryFile(src, filename);
41+
expect(paths).toEqual(true);
42+
});
3643
});

src/plugin/metro.spec.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ describe("bundle", () => {
1717
expect(res).toMatchSnapshot();
1818
});
1919

20+
it("default (tsx)", async () => {
21+
const filename = "app-export-default.tsx";
22+
const filePath = resolvePath(filename);
23+
const res = await bundle(filePath);
24+
expect(res).toMatchSnapshot();
25+
});
26+
2027
it("with json", async () => {
2128
const filename = "app-export-default-with-json.jsx";
2229
const filePath = resolvePath(filename);

0 commit comments

Comments
 (0)