Skip to content

Commit

Permalink
commit updates and reverts #2811
Browse files Browse the repository at this point in the history
  • Loading branch information
salomon-j committed Mar 1, 2023
1 parent e789f9b commit bdb0de1
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 76 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
with:
mongodb-version: '5.0'

- name: Build and run clover coverage report with Gradle
- name: Build and run jacoco coverage report with Gradle
uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee
with:
arguments: test
Expand Down
76 changes: 21 additions & 55 deletions gradle/jacoco.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,34 @@ jacoco {

test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
jacoco {
excludes = ['**/Application.groovy',
'**/BootStrap.groovy',
'**/UrlMappings.groovy',
'**/*GrailsPlugin.groovy',
'**/*Mock.groovy',
'com.skedgo.converter.*']
}
}


test {
finalizedBy jacocoTestReport // report is always generated after tests run
}
jacocoTestReport {
dependsOn test // tests are required to run before generating the report
}

jacocoTestReport {
dependsOn test
finalizedBy jacocoTestCoverageVerification // report is always generated after tests run
}
afterEvaluate {
getClassDirectories().setFrom(classDirectories.files.collect {
fileTree(dir: it,
exclude: [
'**/TimezoneMapper.class'
]
)
})
}

jacocoTestReport {
reports {
xml.required = false
csv.required = false
html.outputLocation = layout.buildDirectory.dir('jacocoHtml')
xml.enabled false
csv.enabled false
html.destination file("${buildDir}/reports/jacocoHtml")
}
}

Expand All @@ -39,44 +45,4 @@ jacocoTestCoverageVerification {
}
}
}
}

//test {
// useJUnitPlatform()
// jacoco {
// excludes = ['**/Application.groovy',
// '**/BootStrap.groovy',
// '**/UrlMappings.groovy',
// '**/*GrailsPlugin.groovy',
// '**/*Mock.groovy',
// 'com.skedgo.converter.*']
// }
//}
//jacocoTestReport {
// dependsOn test
//
// afterEvaluate {
// getClassDirectories().setFrom(classDirectories.files.collect {
// fileTree(dir: it,
// exclude: [
// '**/TimezoneMapper.class'
// ]
// )
// })
// }
// reports {
// xml.enabled false
// csv.enabled false
// html.destination file("${buildDir}/reports/jacocoHtml")
// }
//}
//
//jacocoTestCoverageVerification {
// violationRules {
// rule {
// limit {
// minimum = 0.31
// }
// }
// }
//}
}
40 changes: 20 additions & 20 deletions src/test/groovy/au/org/ala/merit/AdminControllerSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -169,24 +169,24 @@ class AdminControllerSpec extends Specification implements ControllerUnitTest<Ad
0 * settingService._
}

// void "Retriever HUB Roles"(){
// setup:
// HubSettings hubSettings = new HubSettings(hubId:'00cf9ffd-e30c-45f8-99db-abce8d05c0d8')
// SettingService.setHubConfig(hubSettings)
// def roles = roleService.MERIT_HUB_ROLES
// def hubFlg = true
//
// when:
// def results = controller.createUserHubPermission()
//
// then:
// 1 * userService.getUser() >> [userId:'129333', userName: 'jsalomon']
//
// and:
// view == '/admin/createUserHubPermission'
// model.roles == roles
// model.hubId == '00cf9ffd-e30c-45f8-99db-abce8d05c0d8'
// model.hubFlg == true
//
// }
void "Retriever HUB Roles"(){
setup:
HubSettings hubSettings = new HubSettings(hubId:'00cf9ffd-e30c-45f8-99db-abce8d05c0d8')
SettingService.setHubConfig(hubSettings)
def roles = roleService.MERIT_HUB_ROLES
def hubFlg = true

when:
def results = controller.createUserHubPermission()

then:
1 * userService.getUser() >> [userId:'129333', userName: 'jsalomon']

and:
view == '/admin/createUserHubPermission'
model.roles == roles
model.hubId == '00cf9ffd-e30c-45f8-99db-abce8d05c0d8'
model.hubFlg == true

}
}

0 comments on commit bdb0de1

Please sign in to comment.