Skip to content

Instantly share code, notes, and snippets.

@ahuggins
Created January 25, 2019 17:03
Show Gist options
  • Select an option

  • Save ahuggins/4a0fe663efa87184c2cdeb0733033dda to your computer and use it in GitHub Desktop.

Select an option

Save ahuggins/4a0fe663efa87184c2cdeb0733033dda to your computer and use it in GitHub Desktop.
Final Test with instance()
import React from 'react';
import { render, mount, shallow } from 'enzyme';
import EditDatasource from './EditDatasource';
import { MemoryRouter } from 'react-router-dom';
describe('tests for EditDatasource', function () {
it.only('changes the datasource.type when a select button is clicked', function () {
const wrap = mount(
<MemoryRouter>
<EditDatasource
notify={notify}
navigate={navigate}
action={actionSetup()} />
</MemoryRouter>
);
expect(wrap.find(EditDatasource).instance().state.datasource.type === 'datawarehouse').to.be.true;
wrap.find('.manualUpload').simulate('click');
expect(wrap.find(EditDatasource).instance().state.datasource.type === 'manual').to.be.true;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment