/* eslint max-nested-callbacks: ["error", 3] */
import React from 'react';
import ShallowRenderer from 'react-test-renderer/shallow';
import {Map} from 'immutable';
import fh from '@ciscospark/test-helper-file';

import FileStagingArea from '.';

const renderer = new ShallowRenderer();

describe('FileStagingArea component', () => {
  let props;
  let txtFile = 'sample-text-one.txt';
  let pptFile = 'sample-powerpoint-two-page.ppt';

  beforeAll(() =>
    Promise.all([
      fh.fetchWithoutMagic(txtFile),
      fh.fetchWithoutMagic(pptFile)
    ])
      .then((res) => {
        [txtFile, pptFile] = res;
        txtFile.type = 'text/plain';
        txtFile.id = 'txtFile';
        pptFile.type = 'application/vnd.openxmlformats-officedocument.presentationml.presentation';
        pptFile.id = 'pptFile';
      }));

  beforeEach(() => {
    props = {
      files: new Map({txtFile, pptFile}),
      onFileRemove: jest.fn(),
      onSubmit: jest.fn()
    };
  });


  it('renders properly', () => {
    renderer.render(<FileStagingArea {...props} />);
    const component = renderer.getRenderOutput();

    expect(component).toMatchSnapshot();
  });
});

/* eslint max-nested-callbacks: ["error", 3] */
import React from 'react';
import ShallowRenderer from 'react-test-renderer/shallow';
import {Map} from 'immutable';
import fh from '@webex/test-helper-file';

import FileStagingArea from '.';

const renderer = new ShallowRenderer();

describe('FileStagingArea component', () => {
  let props;
  let txtFile = 'sample-text-one.txt';
  let pptFile = 'sample-powerpoint-two-page.ppt';

  beforeAll(() =>
    Promise.all([
      fh.fetchWithoutMagic(txtFile),
      fh.fetchWithoutMagic(pptFile)
    ])
      .then((res) => {
        [txtFile, pptFile] = res;
        txtFile.type = 'text/plain';
        txtFile.id = 'txtFile';
        pptFile.type = 'application/vnd.openxmlformats-officedocument.presentationml.presentation';
        pptFile.id = 'pptFile';
      }));

  beforeEach(() => {
    props = {
      files: new Map({txtFile, pptFile}),
      onFileRemove: jest.fn(),
      onSubmit: jest.fn()
    };
  });


  it('renders properly', () => {
    renderer.render(<FileStagingArea {...props} />);
    const component = renderer.getRenderOutput();

    expect(component).toMatchSnapshot();
  });
});

convert to @webex sdk