Skip to content

Commit

Permalink
Merge pull request #1985 from sanger/develop
Browse files Browse the repository at this point in the history
Merging develop to master- version 10.7.6
  • Loading branch information
seenanair authored Oct 1, 2024
2 parents 95a7be9 + e280382 commit 3d7ce9c
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .release-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.7.5
10.7.6
25 changes: 17 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@
"pinia": "^2.2.2",
"postcss": "^8.4.47",
"swrv": "^1.0.4",
"tailwindcss": "3.4.12",
"tailwindcss": "3.4.13",
"vite": "^5.4.7",
"vue": "^3.5.8",
"vue-router": "^4.4.5",
"vue3-selecto": "^1.12.3",
"vuex": "^4.1.0"
},
"devDependencies": {
"@eslint/js": "^9.11.0",
"@eslint/js": "^9.11.1",
"@pinia/testing": "^0.1.5",
"@vue/test-utils": "^2.4.6",
"better-docs": "^2.7.3",
Expand Down
12 changes: 10 additions & 2 deletions src/api/v2/createRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ const createRequest = ({ rootURL, apiNamespace, resource, headers = {} }) => {
* @return Promise
* Execute a get query with an id
*/
const find = ({ id = '', queryParametersType = QueryParametersType() } = {}) => {
const find = ({
id = '',
include = '',
queryParametersType = QueryParametersType({ include }),
} = {}) => {
return execute('GET', `${resource}/${id}${buildQuery(queryParametersType)}`)
}

Expand All @@ -125,7 +129,11 @@ const createRequest = ({ rootURL, apiNamespace, resource, headers = {} }) => {
* @return Promise
* Execute a create
*/
const create = ({ data, queryParametersType = QueryParametersType() }) => {
const create = ({
data,
include = '',
queryParametersType = QueryParametersType({ include }),
}) => {
return execute('POST', `${resource}${buildQuery(queryParametersType)}`, data)
}

Expand Down
32 changes: 32 additions & 0 deletions tests/e2e/specs/ont/ont_runs_view.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import OntRunsFactory from '../../../factories/OntRunsFactory.js'
import OntRunFactory from '../../../factories/OntRunFactory.js'

describe('ONT Runs view', () => {
it('Visits the ont runs url', () => {
Expand All @@ -23,4 +24,35 @@ describe('ONT Runs view', () => {
cy.get('#created_at').invoke('text').should('match', /\d+/)
cy.get('#actions').invoke('text').should('include', 'Edit').and('include', 'Sample Sheet')
})

it('displays the ONT run page with correct data when clicking on edit run', () => {
cy.wrap(OntRunsFactory()).as('ontRunsFactory')
cy.wrap(OntRunFactory()).as('ontRunFactory')

cy.get('@ontRunsFactory').then((ontRunsFactory) => {
cy.intercept('GET', '/v1/ont/runs?page[size]=25&page[number]=1&include=instrument', {
statusCode: 200,
body: ontRunsFactory.content,
})
})

cy.get('@ontRunFactory').then((ontRunFactory) => {
cy.intercept('GET', '/v1/ont/runs/2?include=flowcells', {
statusCode: 200,
body: ontRunFactory.content,
})
})

cy.intercept('/v1/ont/pools?include=tube,libraries.tag,libraries.request', {
fixture: 'tractionOntPools.json',
})

cy.visit('#/ont/runs')
cy.get('#editRun-2').click()

// Check that the URL is correct
cy.url().should('include', '#/ont/run/2')
cy.get('#flowcell-id-1').invoke('val').should('eq', 'ABC1234')
cy.get('#pool-id-1').invoke('val').should('eq', 'TRAC-2-9')
})
})
52 changes: 52 additions & 0 deletions tests/factories/OntRunFactory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import BaseFactory from './BaseFactory.js'
/**
* Factory for creating ONT run data.
*
* @returns {Object} An object containing the base factory data, find data, and store data.
*/
const OntRunFactory = () => {
const data = {
data: {
id: '2',
type: 'runs',
links: {
self: 'http://127.0.0.1:3100/v1/ont/runs/2',
},
attributes: {
experiment_name: 'ONTRUN-2',
state: 'started',
created_at: '2023-01-11T15:51:13.691Z',
ont_instrument_id: 2,
},
relationships: {
flowcells: {
links: {
self: 'http://127.0.0.1:3100/v1/ont/runs/2/relationships/flowcells',
related: 'http://127.0.0.1:3100/v1/ont/runs/2/flowcells',
},
data: {
type: 'flowcells',
id: '3',
},
},
},
},
included: [
{
id: '3',
type: 'flowcells',
attributes: {
position: 1,
flowcell_id: 'ABC1234',
ont_pool_id: 7,
},
},
],
}

return {
...BaseFactory(data),
}
}

export default OntRunFactory
6 changes: 2 additions & 4 deletions tests/unit/api/v2/createRequest.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,7 @@ describe('createRequest', () => {
fetch.mockReturnValue({ json: () => mockCreate })

const request = createRequest({ ...attributes })
const queryParametersType = QueryParametersType({ include: 'tube' })
const response = await request.create({ data, queryParametersType })
const response = await request.create({ data, include: 'tube' })

expect(fetch).toBeCalledWith('http://traction/v1/requests?include=tube', {
method: 'POST',
Expand Down Expand Up @@ -240,8 +239,7 @@ describe('createRequest', () => {
fetch.mockReturnValue({ json: () => mockResponse })

const request = createRequest({ ...attributes })
const queryParametersType = QueryParametersType({ include: 'sample' })
const response = await request.find({ ...data, queryParametersType })
const response = await request.find({ ...data, include: 'sample' })

expect(fetch).toBeCalledWith('http://traction/v1/requests/1?include=sample', {
method: 'GET',
Expand Down

0 comments on commit 3d7ce9c

Please sign in to comment.