Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Uptime] Ping List Disable expand row if no body present #54898

Merged
merged 10 commits into from
Jan 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

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);
});
});
Loading