Return

All tests / Heating index.tsx

100% Statements 11/11
50% Branches 2/4
100% Functions 1/1
100% Lines 10/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 422x 2x 2x 2x 2x 2x           2x 3x 3x                                                     2x  
import useHeating from '@/hooks/useHeating';
import styles from './heating.module.css';
import RenderManager from '@/components/RenderManager';
import Tooltip from '@/components/Tooltip';
import { FaTemperatureHigh } from 'react-icons/fa';
import { useIntl } from 'react-intl';
 
/**
 * @description - Shows the current temperature of the house and the outside temperature
 * @returns {JSX.Element} - News component
 */
const Heating = () => {
    const { data, error, loading } = useHeating();
    const { formatMessage: f } = useIntl();
 
    return (
        <Tooltip>
            <Tooltip.Trigger>
                <div className={styles.container} data-testid="heating">
                    <FaTemperatureHigh className={styles.icon} />
                    <RenderManager
                        error={error}
                        loading={loading}
                        errorTitle={f({ id: 'heating.error' })}
                        loadingTitle={f({ id: 'heating.loading' })}
                    >
                        <div>{data.outsideTemp ?? 0}</div>|<div>{data.zoneMeasuredTemp ?? 0}</div>
                    </RenderManager>
                </div>
            </Tooltip.Trigger>
            <Tooltip.Content>
                {f(
                    { id: 'heating.tooltip' },
                    { outsideTemp: data.outsideTemp, zoneMeasuredTemp: data.zoneMeasuredTemp }
                )}
            </Tooltip.Content>
        </Tooltip>
    );
};
 
export default Heating;