Skip to content

Commit

Permalink
updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 committed Jan 20, 2020
1 parent 619ca7a commit 8beec5c
Show file tree
Hide file tree
Showing 4 changed files with 169 additions and 1 deletion.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { shallowWithIntl } from 'test_utils/enzyme_helpers';
import React from 'react';
import { DocLinkForBody } from '../doc_link_body';

describe('PingListExpandedRow', () => {
it('renders expected elements for valid props', () => {
expect(shallowWithIntl(<DocLinkForBody />)).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { shallowWithIntl } from 'test_utils/enzyme_helpers';
import { mountWithIntl, renderWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers';
import React from 'react';
import { PingListExpandedRowComponent } from '../expanded_row';
import { Ping } from '../../../../../common/graphql/types';
import { DocLinkForBody } from '../doc_link_body';

describe('PingListExpandedRow', () => {
let ping: Ping;
Expand Down Expand Up @@ -56,4 +57,26 @@ describe('PingListExpandedRow', () => {
delete ping.http;
expect(shallowWithIntl(<PingListExpandedRowComponent ping={ping} />)).toMatchSnapshot();
});

it(`shallow renders link to docs if body is not recorded but it is present`, () => {
// @ts-ignore this shouldn't be undefined unless the beforeEach block is modified
delete ping.http.response.body.content;
expect(shallowWithIntl(<PingListExpandedRowComponent ping={ping} />)).toMatchSnapshot();
});

it(`renders link to docs if body is not recorded but it is present`, () => {
// @ts-ignore this shouldn't be undefined unless the beforeEach block is modified
delete ping.http.response.body.content;
expect(renderWithIntl(<PingListExpandedRowComponent ping={ping} />)).toMatchSnapshot();
});

it(`mount component to find link to docs if body is not recorded but it is present`, () => {
// @ts-ignore this shouldn't be undefined unless the beforeEach block is modified
delete ping.http.response.body.content;
const component = mountWithIntl(<PingListExpandedRowComponent ping={ping} />);

const docLinkComponent = component.find(DocLinkForBody);

expect(docLinkComponent).toHaveLength(1);
});
});

0 comments on commit 8beec5c

Please sign in to comment.