diff --git a/src/components/Cards/ItemCard/ItemCard.jsx b/src/components/Cards/ItemCard/ItemCard.jsx index 1fcf017d9..65c296d5f 100644 --- a/src/components/Cards/ItemCard/ItemCard.jsx +++ b/src/components/Cards/ItemCard/ItemCard.jsx @@ -6,7 +6,7 @@ import ItemCardVariant from './ItemCard.variants' import { useStyles } from './ItemCard.styles' const ItemCard = ({ - label, value, divider, className, variant + label, value, divider = true, className, variant = 'default' }) => { const classes = useStyles() @@ -31,11 +31,6 @@ ItemCard.propTypes = { variant: PropTypes.oneOf(['default', 'boolean', 'euro']) } -ItemCard.defaultProps = { - divider: true, - variant: 'default' -} - ItemCard.displayName = 'ItemCard' export const story = ItemCard diff --git a/src/components/Cards/ItemCard/ItemCard.variants.jsx b/src/components/Cards/ItemCard/ItemCard.variants.jsx index 47efe5147..fb6e84ff7 100644 --- a/src/components/Cards/ItemCard/ItemCard.variants.jsx +++ b/src/components/Cards/ItemCard/ItemCard.variants.jsx @@ -3,7 +3,7 @@ import { Typography } from '@mui/material' import { BooleanIcon, TextEuro } from 'components' -const ItemCardVariant = ({ value, variant }) => { +const ItemCardVariant = ({ value, variant = 'default' }) => { const COMPONENT_VARIANT = { default: {value}, boolean: , @@ -18,10 +18,6 @@ ItemCardVariant.propTypes = { variant: PropTypes.oneOf(['default', 'boolean', 'euro']) } -ItemCardVariant.defaultProps = { - variant: 'default' -} - ItemCardVariant.displayName = 'ItemCardVariant' export default ItemCardVariant diff --git a/src/components/Header/Header.jsx b/src/components/Header/Header.jsx index 9cb24ae49..3bb9c2c08 100644 --- a/src/components/Header/Header.jsx +++ b/src/components/Header/Header.jsx @@ -10,7 +10,7 @@ import uniqId from 'uniqid' import { Button } from 'components' const Header = ({ - className, routes, title, description, buttons, buttonsSecondary, ...rest + className, routes = [], title, description, buttons, buttonsSecondary, ...rest }) => { /** * Renderiza un elemento de la cabecera de navegaciĆ³n @@ -146,8 +146,4 @@ Header.propTypes = { })) } -Header.defaultProps = { - routes: [] -} - export default Header diff --git a/src/components/TableMaterial/TableMaterial.jsx b/src/components/TableMaterial/TableMaterial.jsx index 7a92ccbe1..bd3a45b7b 100644 --- a/src/components/TableMaterial/TableMaterial.jsx +++ b/src/components/TableMaterial/TableMaterial.jsx @@ -18,8 +18,21 @@ import { labelOfRows } from './utils' import { useStyles } from './TableMaterial.styles' const TableMaterial = ({ - className, columns, actions, data, title, refresh, count, onRowClick, withCard, href, multiSelect, - onSelected, rowClass, rowsPerPageOptions, ...rest + className, + columns, + actions, + data = [], + title, + refresh, + count = 0, + onRowClick, + withCard = true, + href, + multiSelect, + onSelected, + rowClass, + rowsPerPageOptions, + ...rest }) => { const classes = useStyles() const [page, setPage] = useState(0) @@ -68,19 +81,19 @@ const TableMaterial = ({ {Boolean(count) && - ( - - )} + ( + + )} ) } @@ -102,11 +115,5 @@ TableMaterial.propTypes = { rowsPerPageOptions: PropTypes.array } -TableMaterial.defaultProps = { - data: [], - count: 0, - withCard: true -} - export const story = TableMaterial export default TableMaterial diff --git a/src/pages/Clients/components/Clients.test.jsx b/src/pages/Clients/components/Clients.test.jsx index ae4d5ade7..2097caddf 100644 --- a/src/pages/Clients/components/Clients.test.jsx +++ b/src/pages/Clients/components/Clients.test.jsx @@ -2,8 +2,13 @@ import { render, screen, act, setupMsw } from 'tests/testUtils' import { describe, expect, it, beforeEach, vi, afterEach } from 'vitest' +import { SettingsProvider } from 'context/SettingsContext' +import { restoreSettings } from 'utils/settings' + import Clients from './Clients' +const settings = restoreSettings() + const notificationMock = { showError: vi.fn() .mockImplementation((a) => console.error(a)) @@ -18,7 +23,13 @@ vi.mock('../../../hooks/useNotifications', () => { describe('Clients', () => { setupMsw() beforeEach(() => { - act(() => { render() } + act(() => { + render( + + + + ) + } ) })