-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pex select creds #159
Pex select creds #159
Conversation
…xchange.kt Co-authored-by: Andres Uribe <[email protected]>
…ationSubmission.kt Co-authored-by: Andres Uribe <[email protected]>
…ationSubmission.kt Co-authored-by: Andres Uribe <[email protected]>
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #159 +/- ##
==========================================
- Coverage 77.43% 77.13% -0.30%
==========================================
Files 33 33
Lines 1928 1929 +1
Branches 265 265
==========================================
- Hits 1493 1488 -5
+ Misses 301 297 -4
- Partials 134 144 +10
|
credentials/src/main/kotlin/web5/sdk/credentials/model/PresentationSubmission.kt
Outdated
Show resolved
Hide resolved
credentials/src/main/kotlin/web5/sdk/credentials/PresentationExchange.kt
Show resolved
Hide resolved
@Test | ||
fun select_credentials() { | ||
val typeRef = object : TypeReference<TestVectors<SelectCredTestInput, SelectCredTestOutput>>() {} | ||
val testVectors = mapper.readValue(File("../test-vectors/presentation_exchange/select_credentials.json"), typeRef) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be tests for the error cases ? Some examples I'm thinking about:
UnsupportedOperationException
is thrown- When
inputDescriptorToVcMap.size != presentationDefinition.inputDescriptors.size
- When
JsonPathParseException
is thrown.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 I think some of the tests above (multiple input descriptors, filtering array vs filtering on value) could be included in the vectors as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yes many more test vectors coming soon (tm),
I was doing this one simple success as a steel thread for the overall web5-kt + web5-js check marks in web5-sdk-development
@@ -427,4 +430,152 @@ class PresentationExchangeTest { | |||
assertEquals("$.verifiableCredential[0]", presentationSubmission.descriptorMap[0].path) | |||
} | |||
} | |||
|
|||
@Nested | |||
inner class SelectCredentials { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these tests unrelated to the vector tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup these are just normal unit tests, testing some of the same things
} | ||
|
||
|
||
class Web5TestVectorsPresentationExchangeTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wdyt about extracting all the vector tests into a separate file so you can tell based on the file name whether it's a vector test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thought did cross my mind.
You mean having a new test file called TestVectorTests.kt
and then having credentials test and pex and everything in the credentials package in there?
I could go either way, I do like having the test vector in the same file as the normal unit tests. Less overhead for the devs I think.
Also there would be a lot of imports in the TestVectorTests.kt file, would have to import all stuff from all packages basically
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah did mean something like that, but agree it does feel more natural to have the tests oriented around feature.
Overview
Selects credentials that satisfy a given presentation definition.
Description
This PR Implements a new features
selectCredentials
This would be used by the user to select which credentials they want to use to satisfy a presentation definition