Skip to content

Commit bb6a181

Browse files
committed
Fixed failing tests
1 parent cb1f459 commit bb6a181

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

src/main/groovy/au/org/ala/ecodata/converter/SciStarterConverter.groovy

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,9 @@ class SciStarterConverter {
8686
[
8787
'easy': 'Easy',
8888
'medium': 'Medium',
89-
'difficult': 'Hard'
90-
][props.difficulty.label.toLowerCase()]
89+
'difficult': 'Hard',
90+
'unknown': null
91+
][props.difficulty ? props.difficulty.label.toLowerCase() : 'unknown']
9192
}
9293
],
9394
'begin' : [

src/test/groovy/au/org/ala/ecodata/ProjectControllerSpec.groovy

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,11 @@ class ProjectControllerSpec extends Specification implements ControllerUnitTest<
431431
controller.importProjectsFromSciStarter()
432432

433433
then:
434-
1 * projectService.importProjectsFromSciStarter() >> 1
434+
1 * projectService.importProjectsFromSciStarter() >> [created: 1, updated: 2, skipped: 3]
435435
response.status == HttpStatus.SC_OK
436-
response.getJson().count == 1
436+
response.getJson().created == 1
437+
response.getJson().updated == 2
438+
response.getJson().skipped == 3
437439
}
438440

439441
void "Download project Metrics - without params"() {

src/test/groovy/au/org/ala/ecodata/converter/SciStarterConverterSpec.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class SciStarterConverterSpec extends Specification implements GrailsUnitTest {
1414
countries:[], uNRegions: [], biocollect: [ scienceType: [] ]])
1515

1616

17-
Map props = [difficulty: [1,2, 3, 'ma', 'medium', 'Easy']]
17+
Map props = [difficulty: [value: 2, label: 'Medium']]
1818

1919
when:
2020
def result = SciStarterConverter.convert(props, [:])
@@ -23,7 +23,7 @@ class SciStarterConverterSpec extends Specification implements GrailsUnitTest {
2323
result.difficulty == "Medium"
2424

2525
when:
26-
result = SciStarterConverter.convert([difficulty: 'Easy'])
26+
result = SciStarterConverter.convert([difficulty: [value: 1, label: 'Easy']])
2727

2828
then:
2929
result.difficulty == "Easy"

0 commit comments

Comments
 (0)