Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion __tests__/Storyshots.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import initStoryshots from '@storybook/addon-storyshots';
import React from 'react';
import { act, create } from 'react-test-renderer';

jest.mock('rn-fetch-blob', () => ({
fs: {
Expand All @@ -19,4 +21,19 @@ jest.mock('react-native-file-viewer', () => ({
jest.mock('../app/lib/database', () => jest.fn(() => null));
global.Date.now = jest.fn(() => new Date('2019-10-10').getTime());

initStoryshots();
initStoryshots({
asyncJest: true,
test: async ({ story, done }) => {
let renderer;
try {
act(() => {
renderer = create(React.createElement(story.render));
});
await act(() => new Promise(resolve => setTimeout(resolve, 0)));
expect(renderer).toMatchSnapshot();
renderer.unmount();
done();
} finally {
}
}
});
88 changes: 48 additions & 40 deletions __tests__/__snapshots__/Storyshots.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -47485,24 +47485,26 @@ exports[`Storyshots Message With audio 1`] = `
}
}
>
<ActivityIndicator
animating={true}
color="#9ca2a8"
hidesWhenStopped={true}
size="small"
<Text
allowFontScaling={false}
style={
Array [
Object {
"alignItems": "center",
"backgroundColor": "transparent",
"marginHorizontal": 10,
"color": "#1d74f5",
"fontSize": 36,
},
undefined,
Object {
"marginHorizontal": 8,
"fontFamily": "custom",
"fontStyle": "normal",
"fontWeight": "normal",
},
Object {},
]
}
/>
>
</Text>
</View>
<RNCSlider
animateTransitions={true}
Expand Down Expand Up @@ -47850,24 +47852,26 @@ exports[`Storyshots Message With audio 1`] = `
}
}
>
<ActivityIndicator
animating={true}
color="#9ca2a8"
hidesWhenStopped={true}
size="small"
<Text
allowFontScaling={false}
style={
Array [
Object {
"alignItems": "center",
"backgroundColor": "transparent",
"marginHorizontal": 10,
"color": "#1d74f5",
"fontSize": 36,
},
undefined,
Object {
"marginHorizontal": 8,
"fontFamily": "custom",
"fontStyle": "normal",
"fontWeight": "normal",
},
Object {},
]
}
/>
>
</Text>
</View>
<RNCSlider
animateTransitions={true}
Expand Down Expand Up @@ -48077,24 +48081,26 @@ exports[`Storyshots Message With audio 1`] = `
}
}
>
<ActivityIndicator
animating={true}
color="#9ca2a8"
hidesWhenStopped={true}
size="small"
<Text
allowFontScaling={false}
style={
Array [
Object {
"alignItems": "center",
"backgroundColor": "transparent",
"marginHorizontal": 10,
"color": "#1d74f5",
"fontSize": 36,
},
undefined,
Object {
"marginHorizontal": 8,
"fontFamily": "custom",
"fontStyle": "normal",
"fontWeight": "normal",
},
Object {},
]
}
/>
>
</Text>
</View>
<RNCSlider
animateTransitions={true}
Expand Down Expand Up @@ -48259,24 +48265,26 @@ exports[`Storyshots Message With audio 1`] = `
}
}
>
<ActivityIndicator
animating={true}
color="#9ca2a8"
hidesWhenStopped={true}
size="small"
<Text
allowFontScaling={false}
style={
Array [
Object {
"alignItems": "center",
"backgroundColor": "transparent",
"marginHorizontal": 10,
"color": "#1d74f5",
"fontSize": 36,
},
undefined,
Object {
"marginHorizontal": 8,
"fontFamily": "custom",
"fontStyle": "normal",
"fontWeight": "normal",
},
Object {},
]
}
/>
>
</Text>
</View>
<RNCSlider
animateTransitions={true}
Expand Down
3 changes: 1 addition & 2 deletions app/views/RoomView/LoadMore/LoadMore.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import LoadMore from './index';

const stories = storiesOf('LoadMore', module);

// FIXME: for some reason, this promise never resolves on Storybook (it works on the app, so maybe the issue isn't on the component)
const load = () => new Promise(res => setTimeout(res, 1000));
const load = () => new Promise(res => setTimeout(res, 0));

stories.add('basic', () => (
<>
Expand Down