Fix ValueMappingEditor test TS issue (#22895)

* fix test

* Revert "CircleCI: Don't build Storybook on PR (#22865)"

This reverts commit 492264abc3.
This commit is contained in:
Dominik Prokop 2020-03-19 16:48:49 +01:00 committed by GitHub
parent a61af9ed1d
commit cb9dd6631b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 14 deletions

View File

@ -1124,8 +1124,7 @@ workflows:
- build-enterprise-windows-installer
- end-to-end-tests
- build-release-publisher
- publish-storybook:
filters: *filter-master-or-release
- publish-storybook
- build-docker-images:
# No filters, meaning this job runs for all branches
name: build-oss-docker-images

View File

@ -19,14 +19,7 @@ const setup = (spy?: any, propOverrides?: object) => {
Object.assign(props, propOverrides);
const wrapper = mount(<ValueMappingsEditor {...props} />);
const instance = wrapper.instance() as ValueMappingsEditor;
return {
instance,
wrapper,
};
return mount(<ValueMappingsEditor {...props} />);
};
describe('Render', () => {
@ -38,7 +31,7 @@ describe('Render', () => {
describe('On remove mapping', () => {
it('Should remove mapping at index 0', () => {
const onChangeSpy = jest.fn();
const { wrapper } = setup(onChangeSpy);
const wrapper = setup(onChangeSpy);
const remove = wrapper.find('*[aria-label="FieldConfigItemHeaderTitle remove button"]');
remove.at(0).simulate('click');
expect(onChangeSpy).toBeCalledWith([
@ -48,7 +41,7 @@ describe('On remove mapping', () => {
it('should remove mapping at index 1', () => {
const onChangeSpy = jest.fn();
const { wrapper } = setup(onChangeSpy);
const wrapper = setup(onChangeSpy);
const remove = wrapper.find('*[aria-label="FieldConfigItemHeaderTitle remove button"]');
remove.at(1).simulate('click');
@ -62,7 +55,7 @@ describe('On remove mapping', () => {
describe('Next id to add', () => {
it('should be 3', () => {
const onChangeSpy = jest.fn();
const { wrapper } = setup(onChangeSpy);
const wrapper = setup(onChangeSpy);
const add = wrapper.find('*[aria-label="ValueMappingsEditor add mapping button"]');
add.at(0).simulate('click');
@ -76,7 +69,7 @@ describe('Next id to add', () => {
it('should default to 0', () => {
const onChangeSpy = jest.fn();
const { wrapper } = setup(onChangeSpy, { valueMappings: [] });
const wrapper = setup(onChangeSpy, { valueMappings: [] });
const add = wrapper.find('*[aria-label="ValueMappingsEditor add mapping button"]');
add.at(0).simulate('click');
expect(onChangeSpy).toBeCalledWith([