Skip to content

Commit 1b479ca

Browse files
authored
Merge pull request #126 from UgnisSoftware/UGN-360
UGN-360 - parseRaw:true parameter tests
2 parents 347c4e5 + c3445f3 commit 1b479ca

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/steps/SelectHeaderStep/tests/SelectHeaderStep.test.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,26 @@ test("Should show error toast if error is thrown in selectHeaderStepHook", async
138138
})
139139
})
140140

141-
test("dateFormat property should be applied to dates read from csv files", async () => {
141+
test("dateFormat property should NOT be applied to dates read from csv files IF parseRaw=true", async () => {
142142
const file = new File([RAW_DATE], "test.csv", {
143143
type: "text/csv",
144144
})
145-
render(<ReactSpreadsheetImport {...mockRsiValues} dateFormat="yyyy/mm/dd" />)
145+
render(<ReactSpreadsheetImport {...mockRsiValues} dateFormat="yyyy/mm/dd" parseRaw={true} />)
146+
147+
const uploader = screen.getByTestId("rsi-dropzone")
148+
fireEvent.drop(uploader, {
149+
target: { files: [file] },
150+
})
151+
152+
const el = await screen.findByText(RAW_DATE, undefined, { timeout: 5000 })
153+
expect(el).toBeInTheDocument()
154+
})
155+
156+
test("dateFormat property should be applied to dates read from csv files IF parseRaw=false", async () => {
157+
const file = new File([RAW_DATE], "test.csv", {
158+
type: "text/csv",
159+
})
160+
render(<ReactSpreadsheetImport {...mockRsiValues} dateFormat="yyyy/mm/dd" parseRaw={false} />)
146161

147162
const uploader = screen.getByTestId("rsi-dropzone")
148163
fireEvent.drop(uploader, {

0 commit comments

Comments
 (0)