-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
305 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
{ | ||
"datasetId": 1975, | ||
"name": "ExteranlAccessTestJL1", | ||
"datasetName": "ExteranlAccessTestJL1", | ||
"createDate": "Nov 2, 2023", | ||
"createUserId": 3396, | ||
"updateDate": 1730999135936, | ||
"updateUserId": 3351, | ||
"alias": 682, | ||
"datasetIdentifier": "DUOS-000682", | ||
"dataUse": { | ||
"generalUse": true, | ||
"hmbResearch": false, | ||
"diseaseRestrictions": [], | ||
"populationOriginsAncestry": false, | ||
"ethicsApprovalRequired": false, | ||
"collaboratorRequired": true, | ||
"geneticStudiesOnly": true, | ||
"publicationResults": true, | ||
"controls": false, | ||
"population": false | ||
}, | ||
"deletable": false, | ||
"properties": [ | ||
{ | ||
"propertyId": 9311, | ||
"datasetId": 1975, | ||
"propertyName": "Data Location", | ||
"propertyValue": "Not Determined", | ||
"schemaProperty": "dataLocation", | ||
"propertyType": "String" | ||
}, | ||
{ | ||
"propertyId": 9312, | ||
"datasetId": 1975, | ||
"propertyName": "# of participants", | ||
"propertyValue": 1, | ||
"schemaProperty": "numberOfParticipants", | ||
"propertyType": "Number" | ||
}, | ||
{ | ||
"propertyId": 9313, | ||
"datasetId": 1975, | ||
"propertyName": "File Types", | ||
"propertyValue": [ | ||
{} | ||
], | ||
"schemaProperty": "fileTypes", | ||
"propertyType": "Json" | ||
} | ||
], | ||
"createUser": { | ||
"userId": 3396, | ||
"email": "[email protected]", | ||
"displayName": "Jonathan Lawson (Admin \u0026 DAC Member)", | ||
"createDate": 1526056488000, | ||
"emailPreference": false, | ||
"institutionId": 150, | ||
"eraCommonsId": "a" | ||
}, | ||
"study": { | ||
"studyId": 5854, | ||
"name": "ExternalAccessTestJL1", | ||
"description": "ExternalAccessTestJL1", | ||
"publicVisibility": true, | ||
"piName": "Dr. Make", | ||
"dataTypes": [ | ||
"Hybrid Capture" | ||
], | ||
"datasetIds": [ | ||
1975, | ||
1976, | ||
1977 | ||
], | ||
"properties": [ | ||
{ | ||
"studyPropertyId": 5860, | ||
"studyId": 5854, | ||
"key": "collaboratingSites", | ||
"type": "Json", | ||
"value": [] | ||
}, | ||
{ | ||
"studyPropertyId": 5855, | ||
"studyId": 5854, | ||
"key": "species", | ||
"type": "String", | ||
"value": "ExternalAccessTestJL1" | ||
}, | ||
{ | ||
"studyPropertyId": 5857, | ||
"studyId": 5854, | ||
"key": "dataCustodianEmail", | ||
"type": "Json", | ||
"value": [ | ||
"[email protected]" | ||
] | ||
}, | ||
{ | ||
"studyPropertyId": 5858, | ||
"studyId": 5854, | ||
"key": "nihAnvilUse", | ||
"type": "String", | ||
"value": "I am not NHGRI funded and do not plan to store data in AnVIL" | ||
}, | ||
{ | ||
"studyPropertyId": 5854, | ||
"studyId": 5854, | ||
"key": "phenotypeIndication", | ||
"type": "String", | ||
"value": "ExternalAccessTestJL1" | ||
}, | ||
{ | ||
"studyPropertyId": 5859, | ||
"studyId": 5854, | ||
"key": "nihICsSupportingStudy", | ||
"type": "Json", | ||
"value": [] | ||
}, | ||
{ | ||
"studyPropertyId": 5853, | ||
"studyId": 5854, | ||
"key": "studyType", | ||
"type": "String", | ||
"value": "Observational" | ||
}, | ||
{ | ||
"studyPropertyId": 5861, | ||
"studyId": 5854, | ||
"key": "alternativeDataSharingPlanReasons", | ||
"type": "Json", | ||
"value": [] | ||
} | ||
], | ||
"createDate": 1698897809861, | ||
"createUserId": 3396 | ||
} | ||
} |
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,167 @@ | ||
/* eslint-disable no-undef,no-console */ | ||
|
||
import React from 'react'; | ||
import {mount} from 'cypress/react'; | ||
import DatasetStatistics from '../../../src/pages/DatasetStatistics'; | ||
import dataset from './dataset.json'; | ||
import {DataSet} from '../../../src/libs/ajax/DataSet'; | ||
import {DatasetMetrics} from '../../../src/libs/ajax/DatasetMetrics'; | ||
|
||
const externalProp = { | ||
'propertyId': 9314, | ||
'datasetId': 1975, | ||
'propertyName': 'Access Management', | ||
'propertyValue': 'external', | ||
'schemaProperty': 'accessManagement', | ||
'propertyType': 'String' | ||
}; | ||
|
||
const openProp = { | ||
'propertyId': 9314, | ||
'datasetId': 1975, | ||
'propertyName': 'Access Management', | ||
'propertyValue': 'open', | ||
'schemaProperty': 'accessManagement', | ||
'propertyType': 'String' | ||
}; | ||
|
||
const controlledProp = { | ||
'propertyId': 9314, | ||
'datasetId': 1975, | ||
'propertyName': 'Access Management', | ||
'propertyValue': 'controlled', | ||
'schemaProperty': 'accessManagement', | ||
'propertyType': 'String' | ||
}; | ||
|
||
const location = { | ||
'propertyId': 12657, | ||
'datasetId': 1975, | ||
'propertyName': 'URL', | ||
'propertyValue': 'https://duos.org', | ||
'schemaProperty': 'url', | ||
'propertyType': 'String' | ||
}; | ||
|
||
describe('Dataset Statistics Tests', () => { | ||
|
||
it('Displays Controlled Access Dataset Apply Button', () => { | ||
const controlled = Object.assign(dataset, {properties: [controlledProp]}); | ||
cy.viewport(600, 800); | ||
cy.stub(DataSet, 'getDatasetByDatasetIdentifier').returns(Promise.resolve(controlled)); | ||
cy.stub(DataSet, 'getDataSetsByDatasetId').returns(Promise.resolve(controlled)); | ||
cy.stub(DatasetMetrics, 'getDatasetStats').returns(Promise.resolve({})); | ||
|
||
const props = { | ||
match: { | ||
params: { | ||
datasetIdentifier: controlled.datasetIdentifier | ||
} | ||
}, | ||
history: { | ||
push() { | ||
} | ||
} | ||
}; | ||
mount(<DatasetStatistics {...props}/>); | ||
cy.contains(controlled.datasetIdentifier).should('exist'); | ||
cy.contains('Apply for Access').should('exist'); | ||
}); | ||
|
||
it('Displays External Access Language With Location', () => { | ||
const external = Object.assign(dataset, {properties: [externalProp, location]}); | ||
cy.viewport(600, 800); | ||
cy.stub(DataSet, 'getDatasetByDatasetIdentifier').returns(Promise.resolve(external)); | ||
cy.stub(DataSet, 'getDataSetsByDatasetId').returns(Promise.resolve(external)); | ||
cy.stub(DatasetMetrics, 'getDatasetStats').returns(Promise.resolve({})); | ||
|
||
const props = { | ||
match: { | ||
params: { | ||
datasetIdentifier: external.datasetIdentifier | ||
} | ||
}, | ||
history: { | ||
push() { | ||
} | ||
} | ||
}; | ||
mount(<DatasetStatistics {...props}/>); | ||
cy.contains(external.datasetIdentifier).should('exist'); | ||
cy.contains('This dataset is externally managed').should('exist'); | ||
cy.contains('Requests cannot be made via DUOS, but must be made directly').should('exist'); | ||
}); | ||
|
||
it('Displays External Access Language Without Location', () => { | ||
const external = Object.assign(dataset, {properties: [externalProp]}); | ||
cy.viewport(600, 800); | ||
cy.stub(DataSet, 'getDatasetByDatasetIdentifier').returns(Promise.resolve(external)); | ||
cy.stub(DataSet, 'getDataSetsByDatasetId').returns(Promise.resolve(external)); | ||
cy.stub(DatasetMetrics, 'getDatasetStats').returns(Promise.resolve({})); | ||
|
||
const props = { | ||
match: { | ||
params: { | ||
datasetIdentifier: external.datasetIdentifier | ||
} | ||
}, | ||
history: { | ||
push() { | ||
} | ||
} | ||
}; | ||
mount(<DatasetStatistics {...props}/>); | ||
cy.contains(external.datasetIdentifier).should('exist'); | ||
cy.contains('This dataset is externally managed').should('exist'); | ||
cy.contains('Requests cannot be made via DUOS, but must be made directly').should('not.exist'); | ||
}); | ||
|
||
it('Displays Open Access Language With Location', () => { | ||
const open = Object.assign(dataset, {properties: [openProp, location]}); | ||
cy.viewport(600, 800); | ||
cy.stub(DataSet, 'getDatasetByDatasetIdentifier').returns(Promise.resolve(open)); | ||
cy.stub(DataSet, 'getDataSetsByDatasetId').returns(Promise.resolve(open)); | ||
cy.stub(DatasetMetrics, 'getDatasetStats').returns(Promise.resolve({})); | ||
|
||
const props = { | ||
match: { | ||
params: { | ||
datasetIdentifier: open.datasetIdentifier | ||
} | ||
}, | ||
history: { | ||
push() { | ||
} | ||
} | ||
}; | ||
mount(<DatasetStatistics {...props}/>); | ||
cy.contains(open.datasetIdentifier).should('exist'); | ||
cy.contains('This dataset is open access, does not require an access request').should('exist'); | ||
cy.contains('and can be accessed directly').should('exist'); | ||
}); | ||
|
||
it('Displays Open Access Language Without Location', () => { | ||
const open = Object.assign(dataset, {properties: [openProp]}); | ||
cy.viewport(600, 800); | ||
cy.stub(DataSet, 'getDatasetByDatasetIdentifier').returns(Promise.resolve(open)); | ||
cy.stub(DataSet, 'getDataSetsByDatasetId').returns(Promise.resolve(open)); | ||
cy.stub(DatasetMetrics, 'getDatasetStats').returns(Promise.resolve({})); | ||
|
||
const props = { | ||
match: { | ||
params: { | ||
datasetIdentifier: open.datasetIdentifier | ||
} | ||
}, | ||
history: { | ||
push() { | ||
} | ||
} | ||
}; | ||
mount(<DatasetStatistics {...props}/>); | ||
cy.contains(open.datasetIdentifier).should('exist'); | ||
cy.contains('This dataset is open access, does not require an access request').should('exist'); | ||
cy.contains('and can be accessed directly').should('not.exist'); | ||
}); | ||
|
||
}); |