create-epic-test
create epic test
Install
$ yarn add --dev create-epic-test
Usage
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: 'キズナアイ' }],
},
},
})
API
createEpicTest(epic, dependencies)
Contributors
Thanks goes to these wonderful people (emoji key):
akameco |
---|
This project follows the all-contributors specification. Contributions of any kind welcome!
License
MIT © akameco