Skip to content

Commit

Permalink
Updated tests #3369
Browse files Browse the repository at this point in the history
chrisala committed Dec 9, 2024
1 parent 6070373 commit 3e9cb29
Showing 4 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -43,7 +43,9 @@ abstract class EditOrViewReportCommand implements Validateable {
model.documentOwner[getEntityIdField()] = id

ReportLifecycleListener listener = reportService.reportLifeCycleListener(model.report)
model.putAll(listener.getContextData(entity, model.report))
if (listener) {
model.putAll(listener.getContextData(entity, model.report))
}
}
}

Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@ class ManagementUnitControllerSpec extends Specification implements ControllerUn
ProjectService projectService = Mock(ProjectService)
MetadataService metadataService = Mock(MetadataService)


String adminUserId = 'admin'
String editorUserId = 'editor'
String grantManagerUserId = 'grantManager'
Original file line number Diff line number Diff line change
@@ -46,6 +46,7 @@ class OrganisationControllerSpec extends Specification implements ControllerUnit
controller.projectService = projectService
controller.reportService = reportService
controller.settingService = settingService
controller.metadataService = metadataService

grails.converters.JSON.registerObjectMarshaller(new MapMarshaller())
grails.converters.JSON.registerObjectMarshaller(new CollectionMarshaller())
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
package au.org.ala.merit.reports

import au.org.ala.ecodata.forms.ActivityFormService
import au.org.ala.merit.MetadataService
import groovy.json.JsonSlurper
import spock.lang.Specification

class ReportLifecycleListenerSpec extends Specification {

ReportLifecycleListener reportData = new ReportLifecycleListener()
ActivityFormService activityFormService = Mock(ActivityFormService)
MetadataService metadataService = Mock(MetadataService)

def setup() {
reportData.activityFormService = activityFormService
reportData.metadataService = metadataService
}


@@ -76,10 +79,10 @@ class ReportLifecycleListenerSpec extends Specification {
]

when:
def result = ReportLifecycleListener.getTargetForReportPeriod(report, scoreId, values)
def result = reportData.getTargetsForReportPeriod(report, values)

then:
result == [period: '2023-12-31', target: 20]
result == [score1:20, score2: 15]
}

private static Map nhtActivityForm() {

0 comments on commit 3e9cb29

Please sign in to comment.