import { createAuthMiddleware } from '../src'

describe('auth middleware', () => {
  const middleware = createAuthMiddleware()
  const nextHandler = middleware({})
  const actionHandler = nextHandler()

  test('it returns a function that handles store', () => {
    expect(middleware).toBeInstanceOf(Function)
    expect(middleware.length).toBe(1)
  })

  test('store handler returns function that handles next', () => {
    expect(nextHandler).toBeInstanceOf(Function)
    expect(nextHandler.length).toBe(1)
  })

  test('action handler returns a function that handles action', () => {
    expect(actionHandler).toBeInstanceOf(Function)
    expect(actionHandler.length).toBe(1)
  })
})

import { createAuthMiddleware } from '../src'

describe('auth middleware', () => {
  const middleware = createAuthMiddleware()

  it('returns a function that handles {getState, dispatch}', () => {
    expect(middleware).toBeInstanceOf(Function)
    expect(middleware.length).toBe(1)
  })

  describe('store handler', () => {
    it('returns function that handles next', () => {
      const nextHandler = middleware({})

      expect(nextHandler).toBeInstanceOf(Function)
      expect(nextHandler.length).toBe(1)
    })
  })

  describe('action handler', () => {
    it('action handler returns a function that handles action', () => {
      const nextHandler = middleware({})
      const actionHandler = nextHandler()

      expect(actionHandler).toBeInstanceOf(Function)
      expect(actionHandler.length).toBe(1)
    })
  })
})

Use it instead of test. Small structure change
Use it instead of test. Small structure change
