import {default as authReducer, initialState} from 'shared/reducers/auth'

import {
  authExpired,
  authRequested,
  authReceived,
  meRequested,
  meReceived,
} from 'shared/actions/auth'

const defaultAuth = {
  links: [
    {
      name: 'github',
      label: 'Github',
      login: '/oauth/github/login',
      logout: '/oauth/github/logout',
      callback: '/oauth/github/callback',
    },
  ],
}

const defaultMe = {
  name: 'wishful_modal@overlay.technology',
  password: '',
  links: {
    self: '/chronograf/v1/users/wishful_modal@overlay.technology',
  },
}

describe('Shared.Reducers.authReducer', () => {
  it('should handle AUTH_EXPIRED', () => {
    const reducedState = authReducer(initialState, authExpired(defaultAuth))

    expect(reducedState.links[0]).to.deep.equal(defaultAuth.links[0])
    expect(reducedState.me).to.equal(null)
    expect(reducedState.isMeLoading).to.equal(false)
    expect(reducedState.isAuthLoading).to.equal(false)
  })

  it('should handle AUTH_REQUESTED', () => {
    const reducedState = authReducer(initialState, authRequested())

    expect(reducedState.isAuthLoading).to.equal(true)
  })
})

@@ -1133,12 +1133,346 @@
 ue)%0A  %7D)
+%0A%0A  it('should handle AUTH_RECEIVED', () =%3E %7B%0A    const loadingState = Object.assign(%7B%7D, initialState, %7BisAuthLoading: true%7D)%0A    const reducedState = authReducer(loadingState, authReceived(defaultAuth))%0A%0A    expect(reducedState.links%5B0%5D).to.deep.equal(defaultAuth.links%5B0%5D)%0A    expect(reducedState.isAuthLoading).to.equal(false)%0A  %7D)
 %0A%7D)%0A

Add test for AUTH_RECEIVED