Skip to content

Commit

Permalink
Add snapshot tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thornbill committed Nov 16, 2021
1 parent 21cf206 commit 17da186
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 4 deletions.
4 changes: 2 additions & 2 deletions components/__tests__/RefreshWebView.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import RefreshWebView from '../RefreshWebView';
// functionality would be very difficult to test properly
describe('RefreshWebView', () => {
it('should render', () => {
const didRender = render(
const { toJSON } = render(
<RefreshWebView
isRefreshing={false}
/>
);

expect(didRender).toBeTruthy();
expect(toJSON()).toMatchSnapshot();
});
});
4 changes: 2 additions & 2 deletions components/__tests__/ThemeSwitcher.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import ThemeSwitcher from '../ThemeSwitcher';
// functionality would be very difficult to test properly
describe('ThemeSwitcher', () => {
it('should render', () => {
const didRender = render(
const { toJSON } = render(
<ThemeProvider>
<ThemeSwitcher />
</ThemeProvider>
);

expect(didRender).toBeTruthy();
expect(toJSON()).toMatchSnapshot();
});
});
73 changes: 73 additions & 0 deletions components/__tests__/__snapshots__/RefreshWebView.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`RefreshWebView should render 1`] = `
<RCTScrollView
collapsable={false}
onGestureHandlerEvent={[Function]}
onGestureHandlerStateChange={[Function]}
onLayout={[Function]}
refreshControl={
<RefreshControlMock
enabled={false}
refreshing={false}
/>
}
showsHorizontalScrollIndicator={false}
showsVerticalScrollIndicator={false}
style={
Object {
"flex": 1,
"height": "100%",
}
}
>
<RCTRefreshControl />
<View>
<View
style={
Array [
Object {
"flex": 1,
"overflow": "hidden",
},
undefined,
]
}
>
<RNCWebView
cacheEnabled={true}
injectedJavaScriptBeforeContentLoadedForMainFrameOnly={true}
injectedJavaScriptForMainFrameOnly={true}
javaScriptEnabled={true}
messagingEnabled={false}
onContentProcessDidTerminate={[Function]}
onHttpError={[Function]}
onLoadingError={[Function]}
onLoadingFinish={[Function]}
onLoadingProgress={[Function]}
onLoadingStart={[Function]}
onMessage={[Function]}
onScroll={[Function]}
onShouldStartLoadWithRequest={[Function]}
source={null}
style={
Array [
Object {
"flex": 1,
"overflow": "hidden",
},
Object {
"backgroundColor": "#ffffff",
},
Object {
"flex": 1,
"height": 1334,
},
]
}
useSharedProcessPool={true}
/>
</View>
</View>
</RCTScrollView>
`;
3 changes: 3 additions & 0 deletions components/__tests__/__snapshots__/ThemeSwitcher.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ThemeSwitcher should render 1`] = `null`;

0 comments on commit 17da186

Please sign in to comment.