-
Notifications
You must be signed in to change notification settings - Fork 49
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
Implement remaining DID Resolution tests. #86
Conversation
ab6306e
to
d295bd6
Compare
…RL including the DID fragment MUST be used."
…ID resolution functions for at least one DID method and MUST be able to return a DID document in at least one conformant representation."
d295bd6
to
241315a
Compare
it.skip('A conforming DID Method specification MUST guarantee that each equivalentId value is logically equivalent to the id property value.', () => { | ||
}); | ||
// As discussed on the 2021-04-13 DID WG topic call, the following test can be skipped (see https://www.w3.org/2019/did-wg/Meetings/Minutes/2021-04-13-did-topic) | ||
it.skip('equivalentId is a much stronger form of equivalence than alsoKnownAs because the equivalence MUST be guaranteed by the governing DID method.', () => { | ||
}); |
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.
it.skip('A conforming DID Method specification MUST guarantee that each equivalentId value is logically equivalent to the id property value.', () => { | |
}); | |
// As discussed on the 2021-04-13 DID WG topic call, the following test can be skipped (see https://www.w3.org/2019/did-wg/Meetings/Minutes/2021-04-13-did-topic) | |
it.skip('equivalentId is a much stronger form of equivalence than alsoKnownAs because the equivalence MUST be guaranteed by the governing DID method.', () => { | |
}); |
I suggest we just not have .skip() and .todo()s in the test suite. We haven't done that elsewhere and it'll be more work than necessary at this point. We do have an accouting/audit of this in the issues that have been raised. I suggest that doing so should be enough for the purposes of CR/PR/REC.
it.skip('A conforming DID Method specification MUST guarantee that the canonicalId value is logically equivalent to the id property value.', () => { | ||
}); |
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.
it.skip('A conforming DID Method specification MUST guarantee that the canonicalId value is logically equivalent to the id property value.', () => { | |
}); |
Suggest removal per https://github.com/w3c/did-test-suite/pull/86/files#r625178855
}); | ||
it('This structure is REQUIRED, and in the case of an error in the resolution process, this MUST NOT be empty.', async () => { | ||
expect(didResolutionMetadata).not.toBeFalsy(); | ||
if (isErrorExpectedOutcome(expectedOutcome)) { | ||
if (utils.isErrorExpectedOutcome(expectedOutcome)) { | ||
expect(Object.keys(didResolutionMetadata)).not.toHaveLength(0); | ||
} | ||
}); | ||
it('If resolveRepresentation was called, this structure MUST contain a contentType property containing the Media Type of the representation found in the didDocumentStream.', async () => { |
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.
This goes for all it()
statements in the test suite. I'm afraid that if we don't prefix each test with the section number, that it's going to be even more difficult for the person doing the test reporting logic to match each test appropriately and automatically tally the "multiple independent implementations" of each feature.
Please see https://github.com/w3c/did-test-suite/blob/main/packages/did-core-test-server/suites/did-core-properties/did-core-properties.js#L14-L16 for an example.
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.
While there are some suggestions that could impact the test report generation, this is an improvement over the current suite and thus should be merged even if those changes aren't made.
Suggested by @msporny in #86 (comment).
Suggested by @msporny in #86 (comment).
@msporny I applied your suggestions. |
@@ -0,0 +1,5 @@ | |||
export default expected => { | |||
const regex = /^\w+\/[-+.\w]+/ |
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.
minor nit that we might prefer this to be something like application/did+...
...
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.
Agree. Do we have the complete list?
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.
minor nit that we might prefer this to be something like
application/did+...
...
I think I disagree, because there are statements in the spec that say something must be a media type, and this is what the predicate is meant for.
Additional tests (such as whether a media type is for a conformant representation of the DID document data model) happen elsewhere.
}; | ||
|
||
const consumeRepresentation = (representation, contentType) => { | ||
// TODO: improve this by re-using other test code |
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.
nit: open an issue an link to it in todo... same could be said for the other todos.
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.
I agree, done: #87
expectConformantMetadataStructure(dereferenceOptions); | ||
describe('dereferencingOptions', () => { | ||
it('7.2 DID URL Dereferencing - A metadata structure.', async () => { | ||
utils.expectConformantMetadataStructure(dereferenceOptions); |
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.
This can be merged with my part of the 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.
I agree, I was planning to do this later (i.e. better re-use existing test code), after this PR is merged.
@@ -0,0 +1,5 @@ | |||
export default expected => { | |||
const regex = /^\w+\/[-+.\w]+/ |
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.
Agree. Do we have the complete list?
describe(implementationName, () => { | ||
it('All conformant DID resolvers MUST implement the DID resolution functions for at least one DID method and MUST be able to return a DID document in at least one conformant representation.', async () => { | ||
expect(implementation.executions).not.toBeEmpty(); | ||
const execution = implementation.executions.find((execution) => (execution.function === 'resolveRepresentation')); |
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.
I like the structure of the test 👍
Suggested by @msporny in #86 (comment).
This implements the remaining DID Resolution and DID URL Dereferencing tests.