Commit 419699a7 authored by Mohammad Nakhaee's avatar Mohammad Nakhaee
Browse files

Correct the precision of the tests

parent 31e5c3a1
Pipeline #134895 passed with stages
in 40 minutes and 4 seconds
......@@ -50,13 +50,13 @@ test('correctly renders edit quantities', async () => {
fireEvent.change(numberFieldValueInput, { target: { value: '1.5' } })
fireEvent.keyDown(numberFieldValueInput, {key: 'Enter', code: 'Enter'})
await waitFor(() => expect(numberFieldValueInput.value).toEqual('1.5'))
await waitFor(() => expect(screen.queryByText(/"float_unit": 7\.937658163559664e-11/i)).toBeInTheDocument())
await waitFor(() => expect(screen.queryByText(/"float_unit": 7\.937658163559662e-11/i)).toBeInTheDocument())
// Change the unit, see that text input changes, debug output remains the same
fireEvent.change(numberFieldUnitInput, { target: { value: 'angstrom' } })
fireEvent.keyDown(numberFieldUnitInput, {key: 'Enter', code: 'Enter'})
await waitFor(() => expect(numberFieldValueInput.value).toEqual('0.7937658163559663'))
await waitFor(() => expect(screen.queryByText(/"float_unit": 7\.937658163559664e-11/i)).toBeInTheDocument())
await waitFor(() => expect(numberFieldValueInput.value).toEqual('0.7937658163559662'))
await waitFor(() => expect(screen.queryByText(/"float_unit": 7\.937658163559662e-11/i)).toBeInTheDocument())
// Enter value with unit, see that only numeric value is preserved in field,
// unit selection has changed and that debug output is correct
......@@ -74,7 +74,7 @@ test('correctly renders edit quantities', async () => {
// Change the unit, see that text input remains the same, debug output changes
fireEvent.change(numberFieldUnitInput, { target: { value: 'bohr' } })
fireEvent.keyDown(numberFieldUnitInput, {key: 'Enter', code: 'Enter'})
await waitFor(() => expect(screen.queryByText(/"float_unit": 7\.937658163559664e-11/i)).toBeInTheDocument())
await waitFor(() => expect(screen.queryByText(/"float_unit": 7\.937658163559662e-11/i)).toBeInTheDocument())
await waitFor(() => expect(numberFieldValueInput.value).toEqual('1.5'))
// Enter value with unit, see that only numeric value is preserved in field,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment