Chore: Upgrade Jest to latest (#25591)

* Chore: Upgrade Jest to latest

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Chore: reduces strict null errors

Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com>
This commit is contained in:
Arve Knudsen
2020-06-15 13:06:37 +02:00
committed by GitHub
parent b1dee9392b
commit 91c24e1f56
11 changed files with 1415 additions and 66 deletions

View File

@@ -1,6 +1,6 @@
import React from 'react';
import { QueryOperationRow } from './QueryOperationRow';
import { shallow, mount } from 'enzyme';
import { mount, shallow } from 'enzyme';
import { act } from 'react-dom/test-utils';
describe('QueryOperationRow', () => {
@@ -17,6 +17,7 @@ describe('QueryOperationRow', () => {
describe('callbacks', () => {
it('should not call onOpen when component is shallowed', async () => {
const onOpenSpy = jest.fn();
// @ts-ignore strict null error, you shouldn't use promise like approach with act but I don't know what the intention is here
await act(async () => {
shallow(
<QueryOperationRow onOpen={onOpenSpy}>
@@ -38,10 +39,13 @@ describe('QueryOperationRow', () => {
const titleEl = wrapper.find({ 'aria-label': 'Query operation row title' });
expect(titleEl).toHaveLength(1);
// @ts-ignore strict null error, you shouldn't use promise like approach with act but I don't know what the intention is here
await act(async () => {
// open
titleEl.first().simulate('click');
});
// @ts-ignore strict null error, you shouldn't use promise like approach with act but I don't know what the intention is here
await act(async () => {
// close
titleEl.first().simulate('click');