Skip to content

Commit b1721b8

Browse files
authored
Merge pull request #70 from UgnisSoftware/UGN-276
Feature UGN-276 throw error if no fields were provided
2 parents 2362bad + 51dfd4e commit b1721b8

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/components/Providers.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ export const rootId = "chakra-modal-rsi"
1515

1616
export const Providers = <T extends string>({ children, theme, rsiValues }: ProvidersProps<T>) => {
1717
const mergedTheme = extendTheme(colorSchemeOverrides, theme)
18+
19+
if (!rsiValues.fields) {
20+
throw new Error("Fields must be provided to react-spreadsheet-import")
21+
}
22+
1823
return (
1924
<RsiContext.Provider value={rsiValues}>
2025
<ChakraProvider>

src/tests/ReactSpreadsheetImport.test.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,9 @@ test("Close modal", async () => {
2424
expect(onClose).toBeCalled()
2525
})
2626
})
27+
28+
test("Close modal", async () => {
29+
const errorRender = () => render(<ReactSpreadsheetImport {...mockRsiValues} fields={undefined} />)
30+
31+
expect(errorRender).toThrow()
32+
})

0 commit comments

Comments
 (0)