/* eslint-disable no-unused-expressions */

const chai = require('chai')
chai.use(require('chai-http'))

const expect = chai.expect

const constants = require('../constants.js')
const app = require('../../../src/index.js')

const body = {
  username: 'adpUser',
  active: 'true',
  name: {
    first: 'TestCnaAdmin',
    last: 'test',
    middle: 'N',
    suffix: 'I'
  },
  authority: {
    active_roles: ['Admin']
  }
}
describe('Testing create user endpoint', () => {
  it('Should return 200 and new user', (done) => {
    chai.request(app)
      .post('/api/org/range_4/user')
      .set(constants.headers)
      .send(body)
      .end((err, res) => {
        expect(err).to.be.null
        expect(res.body).to.have.property('created')
        expect(res.body.created.username).to.equal(body.username)
        expect(res).to.have.status(200)
        done()
      })
  })
})
