Skip to content

Commit

Permalink
[Uptime] Ping List Disable expand row if no body present (elastic#54898
Browse files Browse the repository at this point in the history
…) (elastic#55723)

* update ping list

* update snap

* updated body

* update snaps

* fix i18n

* updated translation

* updated tests
  • Loading branch information
shahzad31 committed Jan 23, 2020
1 parent 1b7e5db commit 0fb7ad7
Show file tree
Hide file tree
Showing 7 changed files with 388 additions and 110 deletions.

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

0 comments on commit 0fb7ad7

Please sign in to comment.