0.2.0 • Published 6 years ago

epic-tester v0.2.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

epic-tester

Build Status tested with jest styled with prettier All Contributors

simple Epic Marble Test

Install

$ yarn add --dev epic-tester

Usage

const { epicTester } = require('epic-tester')

epicTester({
  title: 'Success API',
  epic,
  dependencies: {
    API: {
      getUser: () => Observable.of({ data: { name: 'キズナアイ' } }),
      getUsers: () =>
        Observable.of({
          data: [{ name: 'のじゃロリ' }, { name: 'キズナアイ' }],
        }),
    },
  },
  tests: [
    {
      title: 'FETCH_USER_SUCCESS',
      input$: '--a',
      expect$: '--b',
      values: {
        a: { type: 'FETCH_USER_REQUEST' },
        b: { type: 'FETCH_USER_SUCCESS', payload: { name: 'キズナアイ' } },
      },
    },
    {
      title: 'FETCH_USERS_SUCCESS',
      input$: '--a',
      expect$: '--b',
      values: {
        a: { type: 'FETCH_USERS_REQUEST' },
        b: {
          type: 'FETCH_USERS_SUCCESS',
          payload: [{ name: 'のじゃロリ' }, { name: 'キズナアイ' }],
        },
      },
    },
  ],
})

API

epicTester({title, epic, state, dependencies, tests})

title

Type: string required: true

test title.

epic

required: true

state

dependencies

Type: Object Default: {}

tests

Type: Array<{title, input$, expect$, values}> required: true Default: []

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