Skip to content

Commit

Permalink
Merge pull request #1468 from sanger/dpl-963-fail-pending-tubes-valid…
Browse files Browse the repository at this point in the history
…ation

DPL-963: Fail pending tubes validation
  • Loading branch information
StephenHulme authored Nov 24, 2023
2 parents 135d3d5 + 2816bd0 commit 9688c03
Show file tree
Hide file tree
Showing 12 changed files with 461 additions and 204 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe('MultiStampTubes', () => {

wrapper.vm.updateTube(1, tube1)
wrapper.vm.updateTube(2, tube1)
const validator = wrapper.vm.scanValidation[0]
const validator = wrapper.vm.scanValidation[1]
const validations = validator(tube1.labware)

expect(validations.valid).toEqual(false)
Expand All @@ -113,6 +113,20 @@ describe('MultiStampTubes', () => {
expect(validations.valid).toEqual(true)
})

it('is not valid when we scan pending tubes', async () => {
const wrapper = wrapperFactory()
const pendingTube = {
state: 'valid',
labware: tubeFactory({ state: 'pending' }),
}

wrapper.vm.updateTube(1, pendingTube)
const validator = wrapper.vm.scanValidation[0]
const validations = validator(pendingTube.labware)

expect(validations.valid).toEqual(false)
})

it('sends a post request when the button is clicked', async () => {
let mock = new MockAdapter(localVue.prototype.$axios)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import LabwareScan from 'shared/components/LabwareScan'
import LoadingModal from 'shared/components/LoadingModal'
import Plate from 'shared/components/Plate'
import { validScanMessage } from 'shared/components/scanValidators'
import { checkDuplicates } from 'shared/components/tubeScanValidators'
import { checkDuplicates, checkState } from 'shared/components/tubeScanValidators'
import devourApi from 'shared/devourApi'
import { handleFailedRequest } from 'shared/requestHelpers'
import resources from 'shared/resources'
Expand Down Expand Up @@ -218,7 +218,7 @@ export default {
return [validScanMessage]
}
const currTubes = this.tubes.map((tubeItem) => tubeItem.labware)
return [checkDuplicates(currTubes)]
return [checkState(['passed']), checkDuplicates(currTubes)]
},
},
methods: {
Expand Down
3 changes: 1 addition & 2 deletions app/javascript/shared/components/AssetLookupByUuid.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import localVue from 'test_support/base_vue'

describe('AssetLookupByUuid', () => {
const assetUuid = 'afabla7e-9498-42d6-964e-50f61ded6d9a'
const nullPlate = { data: [] }
const goodPlate = jsonCollectionFactory('plate', [{ uuid: assetUuid }])

const wrapperFactoryPlate = function (api = mockApi()) {
Expand Down Expand Up @@ -35,7 +34,7 @@ describe('AssetLookupByUuid', () => {
filter: { uuid: assetUuid },
fields: {},
},
nullPlate
{ data: [] } // no plates found
)

const wrapper = wrapperFactoryPlate(api)
Expand Down
Loading

0 comments on commit 9688c03

Please sign in to comment.