This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { device, element, by, expect } from 'detox'; | |
describe('<your page>', () => { | |
beforeEach(async () => { | |
await device.reloadReactNative(); | |
}); | |
it('should ...', async () => { | |
await waitFor(element(by.id('your page testID'))) | |
.toBeVisible() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { device, element, by, expect } from 'detox'; | |
describe('StudioGhibliSearchEngineApp', () => { | |
beforeEach(async () => { | |
await device.reloadReactNative(); | |
}); | |
it('should display heading', async () => { | |
await waitFor(element(by.id('search-page'))).toBeVisible().withTimeout(5000); | |
await expect(element(by.id('heading'))).toBeVisible(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { mockFilmEntity } from '@studio-ghibli-search-engine/models'; | |
import { | |
initialRootState, | |
RootState, | |
} from '@studio-ghibli-search-engine/store'; | |
import { render } from '@testing-library/react-native'; | |
import React from 'react'; | |
import { Provider } from 'react-redux'; | |
import configureStore, { MockStoreEnhanced } from 'redux-mock-store'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
initialRootState, | |
RootState, | |
} from '@studio-ghibli-search-engine/store'; | |
import { render } from '@testing-library/react-native'; | |
import React from 'react'; | |
import { Provider } from 'react-redux'; | |
import configureStore, { MockStoreEnhanced } from 'redux-mock-store'; | |
import Film from './film'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jest.mock('@react-navigation/native', () => { | |
return { | |
useNavigation: () => ({ | |
navigate: jest.fn(), | |
dispatch: jest.fn(), | |
}), | |
useRoute: () => ({ | |
params: { | |
id: '123', | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { storiesOf } from '@storybook/react-native'; | |
import React from 'react'; | |
import { Loading } from './loading'; | |
const props = {}; | |
storiesOf('Loading', module).add('Primary', () => <Loading {...props} />); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { render } from '@testing-library/react-native'; | |
import Results from './results'; | |
describe('Results', () => { | |
it('should render successfully', () => { | |
const { container } = render(<Results />); | |
expect(container).toBeTruthy(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
initialRootState, | |
RootState, | |
} from '@studio-ghibli-search-engine/store'; | |
import React from 'react'; | |
import { Provider as StoreProvider } from 'react-redux'; | |
import configureStore from 'redux-mock-store'; | |
import thunk from 'redux-thunk'; | |
export const StoreDecorator = (story) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { storiesOf } from '@storybook/react-native'; | |
import { mockPeopleEntity } from '@studio-ghibli-search-engine/models'; | |
import React from 'react'; | |
import { NavigationDecorator, StoreDecorator } from '../../../storybook/mocks'; | |
import PeopleListItem from './people-list-item'; | |
storiesOf('PeopleListItem', module) | |
.addDecorator(StoreDecorator) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/storybook/mocks/store.tsx | |
import { | |
initialRootState, | |
RootState, | |
} from '@studio-ghibli-search-engine/store'; | |
import React from 'react'; | |
import { Provider as StoreProvider } from 'react-redux'; | |
import configureStore from 'redux-mock-store'; | |
export const StoreDecorator = (story) => { |