From d35e55429ec19b912763d4d2d33fd1448d670b81 Mon Sep 17 00:00:00 2001 From: Noah Overcash Date: Wed, 20 Mar 2024 18:27:55 -0400 Subject: [PATCH] [UICAL-281] Fix failing tests --- src/components/fields/ExceptionFieldUtils.tsx | 2 +- src/test/__mocks__/index.ts | 1 + src/test/__mocks__/stripes-core.mock.ts | 5 +++-- src/test/__mocks__/stripes-smart-components.mock.ts | 3 +++ 4 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 src/test/__mocks__/stripes-smart-components.mock.ts diff --git a/src/components/fields/ExceptionFieldUtils.tsx b/src/components/fields/ExceptionFieldUtils.tsx index d2e31718..c6285518 100644 --- a/src/components/fields/ExceptionFieldUtils.tsx +++ b/src/components/fields/ExceptionFieldUtils.tsx @@ -146,7 +146,7 @@ export function getDateField( usePortal value={innerRow[key]} inputRef={(el) => { - fieldRefs[key][row.i][innerRow.i] = el; + fieldRefs[key][row.i][innerRow.i] = el as HTMLInputElement; }} error={getInnerRowError(isDirty, error, row.i, innerRow.i, 'startDate')} onBlur={() => input.onBlur()} diff --git a/src/test/__mocks__/index.ts b/src/test/__mocks__/index.ts index 3d36fb17..89d54b53 100644 --- a/src/test/__mocks__/index.ts +++ b/src/test/__mocks__/index.ts @@ -1,3 +1,4 @@ import './stripes-components.mock'; import './stripes-config.mock'; import './stripes-core.mock'; +import './stripes-smart-components.mock'; diff --git a/src/test/__mocks__/stripes-core.mock.ts b/src/test/__mocks__/stripes-core.mock.ts index a7276aba..c1d91358 100644 --- a/src/test/__mocks__/stripes-core.mock.ts +++ b/src/test/__mocks__/stripes-core.mock.ts @@ -4,7 +4,7 @@ jest.mock('@folio/stripes/core', () => { }; return { - ...jest.requireActual('@folio/stripes/core'), + CalloutContext: jest.fn(() => ({ sendCallout: jest.fn() })), IfInterface: jest.fn(({ name, children }) => { return name === 'interface' || name === 'service-points-users' ? children : null; }), @@ -20,7 +20,8 @@ jest.mock('@folio/stripes/core', () => { } }), Pluggable: jest.fn(({ children }) => [children]), + TitleManager: jest.fn(({ children }) => children), useOkapiKy: jest.fn(), - useStripes: () => STRIPES, + useStripes: jest.fn(() => STRIPES), }; }); diff --git a/src/test/__mocks__/stripes-smart-components.mock.ts b/src/test/__mocks__/stripes-smart-components.mock.ts new file mode 100644 index 00000000..aa6fb24f --- /dev/null +++ b/src/test/__mocks__/stripes-smart-components.mock.ts @@ -0,0 +1,3 @@ +jest.mock('@folio/stripes/smart-components', () => ({ + Settings: jest.fn(() => 'Settings'), +}));