From 3afa903aaca798aecfc4f69b649019fbe5247691 Mon Sep 17 00:00:00 2001 From: Andrew Cholakian Date: Tue, 14 Jan 2020 17:29:49 -0600 Subject: [PATCH 1/2] Lexicographically sort location tags (#54832) Sort location tags lexicographically, fixes skipped test by providing a stable, non-time-based sort order --- .../__snapshots__/location_status_tags.test.tsx.snap | 8 ++++---- .../location_map/__tests__/location_status_tags.test.tsx | 2 +- .../functional/location_map/location_status_tags.tsx | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/location_map/__tests__/__snapshots__/location_status_tags.test.tsx.snap b/x-pack/legacy/plugins/uptime/public/components/functional/location_map/__tests__/__snapshots__/location_status_tags.test.tsx.snap index 1547bc781acdc..fc17b356880e9 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/location_map/__tests__/__snapshots__/location_status_tags.test.tsx.snap +++ b/x-pack/legacy/plugins/uptime/public/components/functional/location_map/__tests__/__snapshots__/location_status_tags.test.tsx.snap @@ -151,7 +151,7 @@ exports[`LocationStatusTags component renders when all locations are up 1`] = `
- Islamabad + Berlin
@@ -166,7 +166,7 @@ exports[`LocationStatusTags component renders when all locations are up 1`] = `
- 5s ago + 5d ago
@@ -190,7 +190,7 @@ exports[`LocationStatusTags component renders when all locations are up 1`] = `
- Berlin + Islamabad
@@ -205,7 +205,7 @@ exports[`LocationStatusTags component renders when all locations are up 1`] = `
- 5d ago + 5s ago
diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/location_map/__tests__/location_status_tags.test.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/location_map/__tests__/location_status_tags.test.tsx index b1c8c835c72d0..dcab589b794aa 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/location_map/__tests__/location_status_tags.test.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/location_map/__tests__/location_status_tags.test.tsx @@ -11,7 +11,7 @@ import { MonitorLocation } from '../../../../../common/runtime_types/monitor'; import { LocationStatusTags } from '../'; // Failing: https://github.com/elastic/kibana/issues/54818 -describe.skip('LocationStatusTags component', () => { +describe('LocationStatusTags component', () => { let monitorLocations: MonitorLocation[]; it('renders when there are many location', () => { diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/location_map/location_status_tags.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/location_map/location_status_tags.tsx index 6563c03ad7c34..7a632dab5f2cc 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/location_map/location_status_tags.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/location_map/location_status_tags.tsx @@ -60,9 +60,9 @@ export const LocationStatusTags = ({ locations }: Props) => { } }); - // Sort by recent timestamp + // Sort lexicographically by label upLocations.sort((a, b) => { - return a.timestamp < b.timestamp ? 1 : b.timestamp < a.timestamp ? -1 : 0; + return a.label > b.label ? 1 : b.label > a.label ? -1 : 0; }); moment.locale('en', { From e170c69aa5aa7d42c349c0150fcb165aa43f3f1d Mon Sep 17 00:00:00 2001 From: Andrew Cholakian Date: Tue, 14 Jan 2020 20:53:22 -0600 Subject: [PATCH 2/2] Update ping list snapshot --- .../__tests__/__snapshots__/ping_list.test.tsx.snap | 8 -------- 1 file changed, 8 deletions(-) diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/__snapshots__/ping_list.test.tsx.snap b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/__snapshots__/ping_list.test.tsx.snap index eeeb534e47575..148894920eb45 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/__snapshots__/ping_list.test.tsx.snap +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/__snapshots__/ping_list.test.tsx.snap @@ -45,10 +45,6 @@ exports[`PingList component renders sorted list without errors 1`] = ` >