Skip to content

Commit d71a554

Browse files
author
Hector Arce De Las Heras
committed
Delete global structuredClone on tests files
1 parent 4698efa commit d71a554

File tree

6 files changed

+5
-27
lines changed

6 files changed

+5
-27
lines changed

src/components/inputCounter/__tests__/inputCounter.test.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ const mockProps = {
2020
value: 'value',
2121
};
2222

23-
global.structuredClone = jest.fn(val => {
24-
return JSON.parse(JSON.stringify(val));
25-
});
26-
2723
const mockStyles = {
2824
[InputState.EMPTY]: {},
2925
};

src/components/inputCurrency/__tests__/inputCurrency.test.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ const mockProps = {
1818
currencyPosition: POSITIONS.LEFT,
1919
};
2020

21-
global.structuredClone = jest.fn(val => {
22-
return JSON.parse(JSON.stringify(val));
23-
});
24-
2521
const mockStyles = {
2622
[InputState.EMPTY]: {
2723
currencyNameContainerPosition: InputContentPosition.OUT,

src/components/inputDate/__tests__/inputDate.test.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ const mockProps = {
4040
variant: 'DEFAULT',
4141
};
4242

43-
global.structuredClone = jest.fn(val => {
44-
return JSON.parse(JSON.stringify(val));
45-
});
46-
4743
describe('New Input Date Component', () => {
4844
test('Should render InputDate component', () => {
4945
renderProvider(<InputDate {...mockProps} defaultDate={undefined} maxDate={undefined} />);

src/components/inputDropdown/__tests__/inputDropdown.test.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ const mockProps = {
3838

3939
window.matchMedia = windowMatchMedia();
4040

41-
global.structuredClone = jest.fn(val => {
42-
return JSON.parse(JSON.stringify(val));
43-
});
44-
4541
describe('New Input Dropdown Component', () => {
4642
it('Should render InputDropdown component', async () => {
4743
const { container } = renderProvider(<InputDropdown {...mockProps} open={true} />);

src/components/inputPassword/__tests__/inputPassword.test.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ const mockProps = {
1818
value: 'password',
1919
};
2020

21-
global.structuredClone = jest.fn(val => {
22-
return JSON.parse(JSON.stringify(val));
23-
});
24-
2521
describe('New Input Password Component', () => {
2622
it('Should render InputPassword component', async () => {
2723
const { container, getByTestId } = renderProvider(<InputPassword {...mockProps} />);

src/components/inputPhone/__tests__/inputPhone.test.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,13 @@ const mockProps: IInputPhone = {
2121
onChange: jest.fn(),
2222
};
2323

24-
global.structuredClone = jest.fn(val => {
25-
return JSON.parse(JSON.stringify(val));
26-
});
27-
2824
describe('New Input Phone Component', () => {
2925
it('Should display the component correctly', async () => {
3026
const { container, getByText, getByTestId } = renderProvider(
3127
<InputPhone {...mockProps} mask={'###-###-###'} />
3228
);
3329
const phoneInput = getByTestId('IPInputInput');
34-
const prefixBox = getByText(mockProps.prefix.content);
30+
const prefixBox = getByText(mockProps.prefix?.content as string);
3531

3632
expect(phoneInput).toBeInTheDocument();
3733
expect(prefixBox).toBeInTheDocument();
@@ -42,7 +38,9 @@ describe('New Input Phone Component', () => {
4238
});
4339

4440
it('Should display the component correctly without mask', async () => {
45-
const { container, getByTestId } = renderProvider(<InputPhone {...mockProps} />);
41+
const { container, getByTestId } = renderProvider(
42+
<InputPhone {...mockProps} prefixNode="prefixNode" />
43+
);
4644
const phoneInput = getByTestId('IPInputInput');
4745

4846
expect(phoneInput).toBeInTheDocument();
@@ -62,7 +60,7 @@ describe('New Input Phone Component', () => {
6260
/>
6361
);
6462
const phoneInput = getByTestId('IPInputInput');
65-
const prefixBox = getByText(mockProps.prefix.content);
63+
const prefixBox = getByText(mockProps.prefix?.content as string);
6664

6765
expect(phoneInput).toBeInTheDocument();
6866
expect(prefixBox).toBeInTheDocument();

0 commit comments

Comments
 (0)