import { expect } from 'chai'

import {
  setAPIEndpoint,
  setUserToken
} from '../config'

import {
  SET_API_ENDPOINT,
  SET_USER_TOKEN
} from '@instructure/quiz-common/lib/constants'

describe('config action creators', () => {
  it('returns a setAPIEndpoint action ', () => {
    const endpoint = 'data:text/plain,laughs in plain text'
    const action = setAPIEndpoint(endpoint)
    const expectedAction = {
      type: SET_API_ENDPOINT,
      payload: endpoint
    }

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

  it('returns a setUserToken action ', () => {
    const token = 'token1'
    const action = setUserToken(token)
    const expectedAction = {
      type: SET_USER_TOKEN,
      payload: token
    }

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