-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…54637) * update monitor list columns * update columns * update snaps * enhance ui * update SSL Cert to badge warning * fix i18n errors * removed unnecessary margin * update snaps * update ssl * update snaps * added test for warning state * added test for warning state * update test name * update test name Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
- Loading branch information
1 parent
39c1f9f
commit 9aa8e5e
Showing
7 changed files
with
128 additions
and
79 deletions.
There are no files selected for viewing
21 changes: 0 additions & 21 deletions
21
...ublic/components/functional/__tests__/__snapshots__/monitor_ssl_certificate.test.tsx.snap
This file was deleted.
Oops, something went wrong.
38 changes: 0 additions & 38 deletions
38
...cy/plugins/uptime/public/components/functional/__tests__/monitor_ssl_certificate.test.tsx
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
...ional/monitor_status_details/__test__/__snapshots__/monitor_ssl_certificate.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
76 changes: 76 additions & 0 deletions
76
...ic/components/functional/monitor_status_details/__test__/monitor_ssl_certificate.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* 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 React from 'react'; | ||
import moment from 'moment'; | ||
import { mountWithIntl } from 'test_utils/enzyme_helpers'; | ||
import { EuiBadge } from '@elastic/eui'; | ||
import { renderWithIntl } from 'test_utils/enzyme_helpers'; | ||
import { PingTls } from '../../../../../common/graphql/types'; | ||
import { MonitorSSLCertificate } from '../monitor_status_bar'; | ||
|
||
describe('MonitorStatusBar component', () => { | ||
let monitorTls: PingTls; | ||
|
||
beforeEach(() => { | ||
const dateInTwoMonths = moment() | ||
.add(2, 'month') | ||
.toString(); | ||
|
||
monitorTls = { | ||
certificate_not_valid_after: dateInTwoMonths, | ||
}; | ||
}); | ||
|
||
it('renders', () => { | ||
const component = renderWithIntl(<MonitorSSLCertificate tls={monitorTls} />); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
|
||
it('renders null if invalid date', () => { | ||
monitorTls = { | ||
certificate_not_valid_after: 'i am so invalid date', | ||
}; | ||
const component = renderWithIntl(<MonitorSSLCertificate tls={monitorTls} />); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
|
||
it('renders expiration date with a warning state if ssl expiry date is less than 30 days', () => { | ||
const dateIn15Days = moment() | ||
.add(15, 'day') | ||
.toString(); | ||
monitorTls = { | ||
certificate_not_valid_after: dateIn15Days, | ||
}; | ||
const component = mountWithIntl(<MonitorSSLCertificate tls={monitorTls} />); | ||
|
||
const badgeComponent = component.find(EuiBadge); | ||
expect(badgeComponent.props().color).toBe('warning'); | ||
|
||
const badgeComponentText = component.find('.euiBadge__text'); | ||
expect(badgeComponentText.text()).toBe(moment(dateIn15Days).fromNow()); | ||
|
||
expect(badgeComponent.find('span.euiBadge--warning')).toBeTruthy(); | ||
}); | ||
|
||
it('does not render the expiration date with a warning state if expiry date is greater than a month', () => { | ||
const dateIn40Days = moment() | ||
.add(40, 'day') | ||
.toString(); | ||
monitorTls = { | ||
certificate_not_valid_after: dateIn40Days, | ||
}; | ||
const component = mountWithIntl(<MonitorSSLCertificate tls={monitorTls} />); | ||
|
||
const badgeComponent = component.find(EuiBadge); | ||
expect(badgeComponent.props().color).toBe('default'); | ||
|
||
const badgeComponentText = component.find('.euiBadge__text'); | ||
expect(badgeComponentText.text()).toBe(moment(dateIn40Days).fromNow()); | ||
|
||
expect(badgeComponent.find('span.euiBadge--warning')).toHaveLength(0); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters