mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-05 06:09:57 -05:00
Showing high load icon when load is not low. This load icon is only shown if the temperature icon is not displayed.
This commit is contained in:
parent
a7d1912d43
commit
5a07c373fe
4 changed files with 81 additions and 19 deletions
|
|
@ -3,6 +3,14 @@ import {getByTestId, queryByTestId, render, screen} from '@testing-library/react
|
|||
import {CPUTemperatureIcon, DisableDownloadsToggle} from "./Common";
|
||||
import {StatusContext} from "../contexts/contexts";
|
||||
import {startDownloads} from "../components/Common";
|
||||
import {BrowserRouter} from "react-router-dom";
|
||||
|
||||
const mockedUseHref = jest.fn();
|
||||
|
||||
jest.mock("react-router-dom", () => ({
|
||||
...(jest.requireActual("react-router-dom")),
|
||||
useHref: () => mockedUseHref
|
||||
}));
|
||||
|
||||
test('DownloadsToggle is off when loading', async () => {
|
||||
const statusValue = {status: null, fetchStatus: null};
|
||||
|
|
@ -58,7 +66,9 @@ test('DownloadsToggle is on if downloading is On', async () => {
|
|||
test('CPUTemperatureIcon high', async () => {
|
||||
const statusValue = {status: {cpu_info: {temperature: 80, high_temperature: 75, critical_temperature: 90}}};
|
||||
const {container} = render(<StatusContext.Provider value={statusValue}>
|
||||
<CPUTemperatureIcon/>
|
||||
<BrowserRouter>
|
||||
<CPUTemperatureIcon/>
|
||||
</BrowserRouter>
|
||||
</StatusContext.Provider>);
|
||||
|
||||
const icon = getByTestId(container, 'cpuTemperatureIcon');
|
||||
|
|
@ -69,7 +79,9 @@ test('CPUTemperatureIcon high', async () => {
|
|||
test('CPUTemperatureIcon critical', async () => {
|
||||
const statusValue = {status: {cpu_info: {temperature: 100, high_temperature: 75, critical_temperature: 90}}};
|
||||
const {container} = render(<StatusContext.Provider value={statusValue}>
|
||||
<CPUTemperatureIcon/>
|
||||
<BrowserRouter>
|
||||
<CPUTemperatureIcon/>
|
||||
</BrowserRouter>
|
||||
</StatusContext.Provider>);
|
||||
|
||||
const icon = getByTestId(container, 'cpuTemperatureIcon');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue