Skip to content

Commit

Permalink
Merge branch 'feature/ci-test-on-push' into feature/refactorings
Browse files Browse the repository at this point in the history
  • Loading branch information
nodh authored Sep 11, 2023
2 parents 11f14a8 + 05730b0 commit 86c2d81
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ProblemReporterTest : FreeSpec({
val problemReporter = ProblemReporter()

"sorter" - {
withData(ProblemReportSorter.values().asList()) {
withData(ProblemReportSorter.entries) {
val report = ProblemReport(
body = ProblemReportBody(
sorter = it,
Expand All @@ -36,7 +36,7 @@ class ProblemReporterTest : FreeSpec({
}

"scope" - {
withData(ProblemReportScope.values().asList()) {
withData(ProblemReportScope.entries) {
val report = ProblemReport(
body = ProblemReportBody(
sorter = ProblemReportSorter.WARNING,
Expand All @@ -57,7 +57,7 @@ class ProblemReporterTest : FreeSpec({
}

"descriptor" - {
withData(ProblemReportDescriptor.values().asList()) {
withData(ProblemReportDescriptor.entries) {
val report = ProblemReport(
body = ProblemReportBody(
sorter = ProblemReportSorter.WARNING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class ValidatorVcTest : FreeSpec() {

"Manually created and valid credential is valid" - {
withData(
nameFn = ::credentialNameFn,
dataProvider.getCredentialWithType(
verifier.identifier,
attributeTypes = listOf(ConstantIndex.AtomicAttribute2023.vcType)
Expand All @@ -124,6 +125,7 @@ class ValidatorVcTest : FreeSpec() {

"Wrong key ends in wrong signature is not valid" - {
withData(
nameFn = ::credentialNameFn,
dataProvider.getCredentialWithType(
verifier.identifier,
attributeTypes = listOf(ConstantIndex.AtomicAttribute2023.vcType)
Expand All @@ -141,6 +143,7 @@ class ValidatorVcTest : FreeSpec() {

"Invalid sub in credential is not valid" - {
withData(
nameFn = ::credentialNameFn,
dataProvider.getCredentialWithType(
verifier.identifier,
attributeTypes = listOf(ConstantIndex.AtomicAttribute2023.vcType)
Expand All @@ -158,6 +161,7 @@ class ValidatorVcTest : FreeSpec() {

"Invalid issuer in credential is not valid" - {
withData(
nameFn = ::credentialNameFn,
dataProvider.getCredentialWithType(
verifier.identifier,
attributeTypes = listOf(ConstantIndex.AtomicAttribute2023.vcType)
Expand All @@ -174,6 +178,7 @@ class ValidatorVcTest : FreeSpec() {

"Invalid jwtId in credential is not valid" - {
withData(
nameFn = ::credentialNameFn,
dataProvider.getCredentialWithType(
verifier.identifier,
attributeTypes = listOf(ConstantIndex.AtomicAttribute2023.vcType)
Expand All @@ -191,6 +196,7 @@ class ValidatorVcTest : FreeSpec() {

"Invalid type in credential is not valid" - {
withData(
nameFn = ::credentialNameFn,
dataProvider.getCredentialWithType(
verifier.identifier,
attributeTypes = listOf(ConstantIndex.AtomicAttribute2023.vcType)
Expand All @@ -209,6 +215,7 @@ class ValidatorVcTest : FreeSpec() {

"Invalid expiration in credential is not valid" - {
withData(
nameFn = ::credentialNameFn,
dataProvider.getCredentialWithType(
verifier.identifier,
attributeTypes = listOf(ConstantIndex.AtomicAttribute2023.vcType)
Expand All @@ -235,6 +242,7 @@ class ValidatorVcTest : FreeSpec() {

"No expiration date is valid" - {
withData(
nameFn = ::credentialNameFn,
dataProvider.getCredentialWithType(
verifier.identifier,
attributeTypes = listOf(ConstantIndex.AtomicAttribute2023.vcType)
Expand All @@ -251,6 +259,7 @@ class ValidatorVcTest : FreeSpec() {

"Invalid jws-expiration in credential is not valid" - {
withData(
nameFn = ::credentialNameFn,
dataProvider.getCredentialWithType(
verifier.identifier,
attributeTypes = listOf(ConstantIndex.AtomicAttribute2023.vcType)
Expand All @@ -268,6 +277,7 @@ class ValidatorVcTest : FreeSpec() {

"Expiration not matching in credential is not valid" - {
withData(
nameFn = ::credentialNameFn,
dataProvider.getCredentialWithType(
verifier.identifier,
attributeTypes = listOf(ConstantIndex.AtomicAttribute2023.vcType)
Expand All @@ -289,6 +299,7 @@ class ValidatorVcTest : FreeSpec() {

"Invalid NotBefore in credential is not valid" - {
withData(
nameFn = ::credentialNameFn,
dataProvider.getCredentialWithType(
verifier.identifier,
attributeTypes = listOf(ConstantIndex.AtomicAttribute2023.vcType)
Expand All @@ -308,6 +319,7 @@ class ValidatorVcTest : FreeSpec() {

"Invalid issuance date in credential is not valid" - {
withData(
nameFn = ::credentialNameFn,
dataProvider.getCredentialWithType(
verifier.identifier,
attributeTypes = listOf(ConstantIndex.AtomicAttribute2023.vcType)
Expand All @@ -325,6 +337,7 @@ class ValidatorVcTest : FreeSpec() {

"Issuance date and not before not matching is not valid" - {
withData(
nameFn = ::credentialNameFn,
dataProvider.getCredentialWithType(
verifier.identifier,
attributeTypes = listOf(ConstantIndex.AtomicAttribute2023.vcType)
Expand All @@ -341,6 +354,12 @@ class ValidatorVcTest : FreeSpec() {
}
}

private fun credentialNameFn(it: CredentialToBeIssued): String =
when (it) {
is CredentialToBeIssued.Iso -> it.attributeType;is CredentialToBeIssued.Vc -> it.attributeType

}

private fun issueCredential(
credential: CredentialToBeIssued,
issuanceDate: Instant = Clock.System.now(),
Expand Down

0 comments on commit 86c2d81

Please sign in to comment.