import { expect } from 'chai'

import {
  setContextUuid,
  setOutcomesEndpoint,
  setOutcomesToken
} from '../outcomes'

import {
  SET_CONTEXT_UUID,
  SET_OUTCOMES_ENDPOINT,
  SET_OUTCOMES_TOKEN
} from '@instructure/quiz-common/lib/constants'

describe('config action creators', () => {
  it('returns a setContextUuid action ', () => {
    const uuid = 'alphabeta'
    const action = setContextUuid(uuid)
    const expectedAction = {
      type: SET_CONTEXT_UUID,
      payload: uuid
    }

    expect(action).to.deep.equal(expectedAction)
  })

  it('returns a setOutcomesEndpoint action ', () => {
    const endpoint = 'http://outcomes.test'
    const action = setOutcomesEndpoint(endpoint)
    const expectedAction = {
      type: SET_OUTCOMES_ENDPOINT,
      payload: endpoint
    }

    expect(action).to.deep.equal(expectedAction)
  })

  it('returns a setOutcomesToken action ', () => {
    const token = 'alphabetacharlie'
    const action = setOutcomesToken(token)
    const expectedAction = {
      type: SET_OUTCOMES_TOKEN,
      payload: token
    }

    expect(action).to.deep.equal(expectedAction)
  })
})
