From d68a7284b0b58279f028f2f88efca3b66caa07d3 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 12 Sep 2023 08:27:10 +1000 Subject: [PATCH] Added questions to data set #2957 --- .../au/org/ala/merit/DataSetController.groovy | 1 - .../ala/merit/DataSetControllerSpec.groovy | 24 ++++++++++++++++--- src/test/js/spec/DataSetsSpec.js | 3 ++- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/grails-app/controllers/au/org/ala/merit/DataSetController.groovy b/grails-app/controllers/au/org/ala/merit/DataSetController.groovy index 448684507..b591ee36e 100644 --- a/grails-app/controllers/au/org/ala/merit/DataSetController.groovy +++ b/grails-app/controllers/au/org/ala/merit/DataSetController.groovy @@ -75,7 +75,6 @@ class DataSetController { } List projectProtocols = projectService.listProjectProtocols(project).collect{ - println it [label:it.name, value:it.externalId] } diff --git a/src/test/groovy/au/org/ala/merit/DataSetControllerSpec.groovy b/src/test/groovy/au/org/ala/merit/DataSetControllerSpec.groovy index af933f423..305ee63b1 100644 --- a/src/test/groovy/au/org/ala/merit/DataSetControllerSpec.groovy +++ b/src/test/groovy/au/org/ala/merit/DataSetControllerSpec.groovy @@ -38,8 +38,14 @@ class DataSetControllerSpec extends Specification implements ControllerUnitTest< 1 * projectService.getProgramConfiguration(project) >> [program:[name:"program 1"]] 1 * projectService.getAllProjectOutcomes(project) >> ["1", "2"] 1 * projectService.listProjectInvestmentPriorities(project) >> ["p1"] + 1 * projectService.listProjectProtocols(project) >> [["name":"p1", "externalId":"p1"]] + 1 * projectService.listProjectBaselines(project) >> [["code":"b1", baseline:"a baseline"]] + + model == [project:project, projectId:'p1', programName:"program 1", + priorities:["p1"], outcomes:["1", "2"], projectOutcomes:[], + projectBaselines:[[label:"b1 - a baseline", value:"b1"]], + projectProtocols:[[label:"p1", value:"p1"]]] - model == [project:project, projectId:'p1', programName:"program 1", priorities:["p1"], outcomes:["1", "2"], projectOutcomes:[]] } void "If the project cannot be found when editing a dataset, a 404 is returned"() { @@ -76,8 +82,14 @@ class DataSetControllerSpec extends Specification implements ControllerUnitTest< 1 * projectService.getProgramConfiguration(project) >> [program:[name:"program 1"]] 1 * projectService.getAllProjectOutcomes(project) >> ["1", "2"] 1 * projectService.listProjectInvestmentPriorities(project) >> ["p1"] + 1 * projectService.listProjectProtocols(project) >> [["name":"p1", "externalId":"p1"]] + 1 * projectService.listProjectBaselines(project) >> [["code":"b1", baseline:"a baseline"]] + - model == [project:project, projectId:'p1', programName:"program 1", priorities:["p1"], outcomes:["1", "2"], projectOutcomes:[], dataSet:existingDataSets[1]] + model == [project:project, projectId:'p1', programName:"program 1", priorities:["p1"], + outcomes:["1", "2"], projectOutcomes:[], dataSet:existingDataSets[1], + projectBaselines:[[label:"b1 - a baseline", value:"b1"]], + projectProtocols:[[label:"p1", value:"p1"]]] } void "The save method delegates to the projectService"() { @@ -134,7 +146,13 @@ class DataSetControllerSpec extends Specification implements ControllerUnitTest< 1 * projectService.getProgramConfiguration(project) >> [program:[name:"program 1"]] 1 * projectService.getAllProjectOutcomes(project) >> ["1", "2"] 1 * projectService.listProjectInvestmentPriorities(project) >> ["p1"] + 1 * projectService.listProjectProtocols(project) >> [["name":"p1", "externalId":"p1"]] + 1 * projectService.listProjectBaselines(project) >> [["code":"b1", baseline:"a baseline"]] + - model == [project:project, projectId:'p1', programName:"program 1", priorities:["p1"], outcomes:["1", "2"], projectOutcomes:[], dataSet:existingDataSets[1]] + model == [project:project, projectId:'p1', programName:"program 1", priorities:["p1"], + outcomes:["1", "2"], projectOutcomes:[], dataSet:existingDataSets[1], + projectBaselines:[[label:"b1 - a baseline", value:"b1"]], + projectProtocols:[[label:"p1", value:"p1"]]] } } diff --git a/src/test/js/spec/DataSetsSpec.js b/src/test/js/spec/DataSetsSpec.js index a91701f95..cfea35ee3 100644 --- a/src/test/js/spec/DataSetsSpec.js +++ b/src/test/js/spec/DataSetsSpec.js @@ -113,7 +113,8 @@ describe("The data set summaries view models behave correctly", function () { "sizeUnknown": false, "otherSensitivity":null, "otherDataSetType":null, - "sizeInKB": 205 + "sizeInKB": 205, + "protocol":"guid-1" }; }