diff --git a/webpack/assets/javascripts/react_app/components/HostStatuses/Status/Status.test.js b/webpack/assets/javascripts/react_app/components/HostStatuses/Status/Status.test.js
index 1b582d0a48..345e242416 100644
--- a/webpack/assets/javascripts/react_app/components/HostStatuses/Status/Status.test.js
+++ b/webpack/assets/javascripts/react_app/components/HostStatuses/Status/Status.test.js
@@ -1,7 +1,9 @@
+import React from 'react';
+import { render, screen } from '@testing-library/react';
+import '@testing-library/jest-dom';
import Status from '../Status';
import { HOST_STATUSES_KEY } from '../HostStatusesConstants';
import { store } from '../HostStatuses.fixtures.js'
-import { testComponentSnapshotsWithFixtures } from '../../../common/testHelpers';
jest.mock('react-redux', () => ({
...jest.requireActual('react-redux'),
@@ -51,9 +53,36 @@ jest.mock('../HostStatusesSelectors.js', () => {
}
});
-const fixtures = {
- 'renders Status': { name: store.API[HOST_STATUSES_KEY].response.results[0].name },
-};
+const { name } = store.API[HOST_STATUSES_KEY].response.results[0];
+
describe('Status', () => {
- testComponentSnapshotsWithFixtures(Status, fixtures);
+ it('renders Status', () => {
+ render();
+
+ // status name and description
+ expect(screen.getByText('Status Name')).toBeInTheDocument();
+ expect(screen.getByText('Description of the status')).toBeInTheDocument();
+
+ // ok/warn/error totals and owned counts
+ expect(screen.getByText('Total: 3')).toBeInTheDocument();
+ expect(screen.getByText('Owned: 1')).toBeInTheDocument();
+ expect(screen.getByText('Total: 7')).toBeInTheDocument();
+ expect(screen.getByText('Owned: 2')).toBeInTheDocument();
+ expect(screen.getByText('Total: 5')).toBeInTheDocument();
+ expect(screen.getByText('Owned: 0')).toBeInTheDocument();
+
+ // totals link to their status searches
+ expect(screen.getByRole('link', { name: 'Total: 3' })).toHaveAttribute(
+ 'href',
+ '/hosts?search=status+%3D+ok'
+ );
+ expect(screen.getByRole('link', { name: 'Total: 7' })).toHaveAttribute(
+ 'href',
+ '/hosts?search=status+%3D+warn'
+ );
+ expect(screen.getByRole('link', { name: 'Total: 5' })).toHaveAttribute(
+ 'href',
+ '/hosts?search=status+%3D+error'
+ );
+ });
});
diff --git a/webpack/assets/javascripts/react_app/components/HostStatuses/Status/__snapshots__/Status.test.js.snap b/webpack/assets/javascripts/react_app/components/HostStatuses/Status/__snapshots__/Status.test.js.snap
deleted file mode 100644
index 862fe6f639..0000000000
--- a/webpack/assets/javascripts/react_app/components/HostStatuses/Status/__snapshots__/Status.test.js.snap
+++ /dev/null
@@ -1,167 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Status renders Status 1`] = `
-
-
-
-
-
-
-
-
- Status Name
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Description of the status
-
-
-
-
-
-
-
-
-`;