Skip to content

Commit

Permalink
test: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasFridmansky authored and Lipo11 committed Aug 21, 2023
1 parent 41bbdec commit 0daee73
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 53 deletions.
5 changes: 0 additions & 5 deletions jest.setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,6 @@ jest.mock('react-native-gesture-handler', () => {

});

jest.mock('./src/core/helpers/image', () => ({
loadImage: (url) => url,
preloadStories: () => [],
}));

jest.mock('./src/core/helpers/storage', () => ({
clearProgressStorage: () => {},
getProgressStorage: jest.fn(),
Expand Down
21 changes: 0 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 3 additions & 27 deletions tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,12 @@ describe( 'Instagram Stories test', () => {

} );

it( 'Should work with preloadImages & saveProgress', async () => {
it( 'Should work with saveProgress', async () => {

jest.spyOn( Storage, 'getProgressStorage' ).mockImplementation( () => ( { 1: '1' } ) );
const { getByTestId, getAllByTestId } = render(
<InstagramStories
stories={stories2}
preloadImages
saveProgress
/>,
);
Expand Down Expand Up @@ -170,7 +169,6 @@ describe( 'Instagram Stories test', () => {
const { getByTestId } = render(
<InstagramStories
stories={stories3}
preloadImages
saveProgress
/>,
);
Expand Down Expand Up @@ -357,7 +355,7 @@ describe( 'Instagram Stories test', () => {

it( 'Should go to next story', async () => {

const { getByTestId } = render( <InstagramStories preloadImages stories={stories3} /> );
const { getByTestId } = render( <InstagramStories stories={stories3} /> );

await act( async () => {

Expand Down Expand Up @@ -489,14 +487,10 @@ describe( 'Story Image test', () => {

it( 'Should work with wrong story', () => {

render( <StoryImage stories={stories[0].stories} active={{ value: true }} activeStory={{ value: '2' }} defaultImage="url" preloadImages /> );
render( <StoryImage stories={stories[0].stories} active={{ value: true }} activeStory={{ value: '2' }} defaultImage="url" /> );

} );

} );

describe( 'Story Image test', () => {

it( 'Should work if story already loaded', async () => {

const onLoad = jest.fn();
Expand All @@ -506,24 +500,6 @@ describe( 'Story Image test', () => {
active={{ value: true }}
activeStory={{ value: '1' }}
defaultImage="url"
preloadImages
onLoad={onLoad}
/> );

expect( onLoad ).toHaveBeenCalled();

} );

it( 'Should work if story already loaded and preload next image', async () => {

const onLoad = jest.fn();

render( <StoryImage
stories={[ { id: '1', sourceUrl: '' }, { id: '2', sourceUrl: '' } ]}
active={{ value: true }}
activeStory={{ value: '1' }}
defaultImage="url"
preloadImages
onLoad={onLoad}
/> );

Expand Down

0 comments on commit 0daee73

Please sign in to comment.