/* global describe, it */

'use strict'

var expect = require('expect.js')

var MailerLite = require('..')
var ML = new MailerLite()

const LIST_NAME = 'Mocha Test'

describe('Lists', () => {
  it('should return an array', (done) => {
    ML.Lists.getAll()
      .then((data) => {
        expect(data).not.to.be(undefined)
        expect(data).to.have.property('Results')
        expect(data.Results).to.be.an('array')
        done()
      })
  })

  it('should create a list and immediately remove it', (done) => {
    ML.Lists.addList(LIST_NAME)
      .then((data) => {
        expect(data.id).to.be.above(0)
        expect(data.name).to.be.equal(LIST_NAME)
        return ML.Lists.removeList(data.id)
      })
      .then(() => {
        done()
      })
  })
})

@@ -157,16 +157,62 @@
 ha Test'
+%0Aconst LIST_RENAME = 'Mocha Test After Rename'
 %0A%0Adescri
@@ -800,12 +800,411 @@
  %7D)%0A  %7D)
+%0A%0A  it('should create a list, rename it, check if renamed, and remove it', (done) =%3E %7B%0A    ML.Lists.addList(LIST_NAME)%0A      .then((data) =%3E ML.Lists.updateList(data.id, LIST_RENAME))%0A      .then((data) =%3E %7B%0A        expect(data.id).to.be.above(0)%0A        expect(data.name).to.be.equal(LIST_RENAME)%0A        return ML.Lists.removeList(data.id)%0A      %7D)%0A      .then(() =%3E %7B%0A        done()%0A      %7D)%0A  %7D)
 %0A%7D)%0A

Test for list rename.