mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
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:
parent
a61af9ed1d
commit
cb9dd6631b
@ -1124,8 +1124,7 @@ workflows:
|
|||||||
- build-enterprise-windows-installer
|
- build-enterprise-windows-installer
|
||||||
- end-to-end-tests
|
- end-to-end-tests
|
||||||
- build-release-publisher
|
- build-release-publisher
|
||||||
- publish-storybook:
|
- publish-storybook
|
||||||
filters: *filter-master-or-release
|
|
||||||
- build-docker-images:
|
- build-docker-images:
|
||||||
# No filters, meaning this job runs for all branches
|
# No filters, meaning this job runs for all branches
|
||||||
name: build-oss-docker-images
|
name: build-oss-docker-images
|
||||||
|
@ -19,14 +19,7 @@ const setup = (spy?: any, propOverrides?: object) => {
|
|||||||
|
|
||||||
Object.assign(props, propOverrides);
|
Object.assign(props, propOverrides);
|
||||||
|
|
||||||
const wrapper = mount(<ValueMappingsEditor {...props} />);
|
return mount(<ValueMappingsEditor {...props} />);
|
||||||
|
|
||||||
const instance = wrapper.instance() as ValueMappingsEditor;
|
|
||||||
|
|
||||||
return {
|
|
||||||
instance,
|
|
||||||
wrapper,
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('Render', () => {
|
describe('Render', () => {
|
||||||
@ -38,7 +31,7 @@ describe('Render', () => {
|
|||||||
describe('On remove mapping', () => {
|
describe('On remove mapping', () => {
|
||||||
it('Should remove mapping at index 0', () => {
|
it('Should remove mapping at index 0', () => {
|
||||||
const onChangeSpy = jest.fn();
|
const onChangeSpy = jest.fn();
|
||||||
const { wrapper } = setup(onChangeSpy);
|
const wrapper = setup(onChangeSpy);
|
||||||
const remove = wrapper.find('*[aria-label="FieldConfigItemHeaderTitle remove button"]');
|
const remove = wrapper.find('*[aria-label="FieldConfigItemHeaderTitle remove button"]');
|
||||||
remove.at(0).simulate('click');
|
remove.at(0).simulate('click');
|
||||||
expect(onChangeSpy).toBeCalledWith([
|
expect(onChangeSpy).toBeCalledWith([
|
||||||
@ -48,7 +41,7 @@ describe('On remove mapping', () => {
|
|||||||
|
|
||||||
it('should remove mapping at index 1', () => {
|
it('should remove mapping at index 1', () => {
|
||||||
const onChangeSpy = jest.fn();
|
const onChangeSpy = jest.fn();
|
||||||
const { wrapper } = setup(onChangeSpy);
|
const wrapper = setup(onChangeSpy);
|
||||||
|
|
||||||
const remove = wrapper.find('*[aria-label="FieldConfigItemHeaderTitle remove button"]');
|
const remove = wrapper.find('*[aria-label="FieldConfigItemHeaderTitle remove button"]');
|
||||||
remove.at(1).simulate('click');
|
remove.at(1).simulate('click');
|
||||||
@ -62,7 +55,7 @@ describe('On remove mapping', () => {
|
|||||||
describe('Next id to add', () => {
|
describe('Next id to add', () => {
|
||||||
it('should be 3', () => {
|
it('should be 3', () => {
|
||||||
const onChangeSpy = jest.fn();
|
const onChangeSpy = jest.fn();
|
||||||
const { wrapper } = setup(onChangeSpy);
|
const wrapper = setup(onChangeSpy);
|
||||||
|
|
||||||
const add = wrapper.find('*[aria-label="ValueMappingsEditor add mapping button"]');
|
const add = wrapper.find('*[aria-label="ValueMappingsEditor add mapping button"]');
|
||||||
add.at(0).simulate('click');
|
add.at(0).simulate('click');
|
||||||
@ -76,7 +69,7 @@ describe('Next id to add', () => {
|
|||||||
|
|
||||||
it('should default to 0', () => {
|
it('should default to 0', () => {
|
||||||
const onChangeSpy = jest.fn();
|
const onChangeSpy = jest.fn();
|
||||||
const { wrapper } = setup(onChangeSpy, { valueMappings: [] });
|
const wrapper = setup(onChangeSpy, { valueMappings: [] });
|
||||||
const add = wrapper.find('*[aria-label="ValueMappingsEditor add mapping button"]');
|
const add = wrapper.find('*[aria-label="ValueMappingsEditor add mapping button"]');
|
||||||
add.at(0).simulate('click');
|
add.at(0).simulate('click');
|
||||||
expect(onChangeSpy).toBeCalledWith([
|
expect(onChangeSpy).toBeCalledWith([
|
||||||
|
Loading…
Reference in New Issue
Block a user