/* global expect */

describe('UberTaxis 0.0.0-GIT-Repository', function() {
  let Component, c1, testDiv;
  const descriptor = '/EAMD.ucp/Components/com/uber/UberTaxis/0.0.0-GIT-Repository/UberTaxis.component.xml';

  it('should create a testDiv and get the Class ', async () => {
    testDiv = document.createElement('div');
    testDiv.classList.add('hidden');
    document.body.appendChild(testDiv);
    Component = await ONCE.dropSupport.loadDescriptor(descriptor);
  });
  it('testDiv element should be a div and UberTaxis class should exists', done => {
    expect(testDiv).to.be.an.instanceof(HTMLElement);
    expect(Component).to.be.an.instanceof(Function);
    done();
  });
  it('should create 1 instance of UberTaxis and add it into testDiv', done => {
    c1 = Component.getInstance().init();
    expect(c1).to.be.an.instanceof(Component);

    expect(c1).has.hasOwnProperty('properties');
    expect(c1.properties).hasOwnProperty('classes');
    // expect(c1.properties.classes).to.be.a('string');
    c1.defaultView.append(document.body);

    done();
  });

  it('should remove instances of UberTaxis and check testDiv for empty', done => {
    c1.defaultView.remove();
    const componentViews = UcpComponentSupport.getAllUcpViews();
    expect(componentViews).to.be.an.instanceof(Array);
    expect(testDiv.innerHTML).to.be.empty;
    done();
  });
  after(done => {
    testDiv.remove();
    done();
  });
});
