-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(protocol-designer): add air gap form validation (#6226)
6007
- Loading branch information
Showing
7 changed files
with
213 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
protocol-designer/src/steplist/formLevel/test/warnings.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// @flow | ||
import { minAirGapVolume } from '../warnings' | ||
|
||
describe('warnings', () => { | ||
let pipette | ||
beforeEach(() => { | ||
pipette = { | ||
spec: { | ||
minVolume: 100, | ||
}, | ||
} | ||
}) | ||
describe('min air gap volume', () => { | ||
it('should NOT return a warning when the air gap checkbox is not selected', () => { | ||
const fields = { | ||
aspirate_airGap_checkbox: false, | ||
aspirate_airGap_volume: null, | ||
...{ pipette }, | ||
} | ||
expect(minAirGapVolume({ ...fields })).toBe(null) | ||
}) | ||
it('should NOT return a warning when there is no air gap volume specified', () => { | ||
const fields = { | ||
aspirate_airGap_checkbox: true, | ||
aspirate_airGap_volume: null, | ||
...{ pipette }, | ||
} | ||
expect(minAirGapVolume({ ...fields })).toBe(null) | ||
}) | ||
it('should NOT return a warning when the air gap volume is greater than the pipette min volume', () => { | ||
const fields = { | ||
aspirate_airGap_checkbox: true, | ||
aspirate_airGap_volume: '150', | ||
...{ pipette }, | ||
} | ||
expect(minAirGapVolume(fields)).toBe(null) | ||
}) | ||
|
||
it('should NOT return a warning when the air gap volume is equal to the the pipette min volume', () => { | ||
const fields = { | ||
aspirate_airGap_checkbox: true, | ||
aspirate_airGap_volume: '100', | ||
...{ pipette }, | ||
} | ||
expect(minAirGapVolume(fields)).toBe(null) | ||
}) | ||
it('should return a warning when the air gap volume is less than the pipette min volume', () => { | ||
const fields = { | ||
aspirate_airGap_checkbox: true, | ||
aspirate_airGap_volume: '0', | ||
...{ pipette }, | ||
} | ||
expect(minAirGapVolume(fields).type).toBe('BELOW_MIN_AIR_GAP_VOLUME') | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters