create epic test
$ yarn add --dev create-epic-test
const { createEpicTest } = require('create-epic-test')
const successTest = createEpicTest(epic, {
API: {
getUser: () => Observable.of({ data: { name: 'キズナアイ' } }),
getUsers: () =>
Observable.of({
data: [{ name: 'のじゃロリ' }, { name: 'キズナアイ' }],
}),
},
})
successTest('APIが成功したとき、FETCH_USER_SUCCESSを発行する', {
input$: '--a',
expect$: '--b',
values: {
a: { type: 'FETCH_USER_REQUEST' },
b: { type: 'FETCH_USER_SUCCESS', payload: { name: 'キズナアイ' } },
},
})
successTest('APIが成功したとき、FETCH_USERS_SUCCESSを発行する', {
input$: '--a',
expect$: '--b',
values: {
a: { type: 'FETCH_USERS_REQUEST' },
b: {
type: 'FETCH_USERS_SUCCESS',
payload: [{ name: 'のじゃロリ' }, { name: 'キズナアイ' }],
},
},
})
Thanks goes to these wonderful people (emoji key):
akameco 💻 📖 |
---|
This project follows the all-contributors specification. Contributions of any kind welcome!
MIT © akameco