Skip to content
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

Merged
merged 11 commits into from
May 6, 2021

Conversation

peacekeeper
Copy link
Contributor

This implements the remaining DID Resolution and DID URL Dereferencing tests.

@peacekeeper peacekeeper force-pushed the peacekeeper-finalize-resolution-dereferencing branch from ab6306e to d295bd6 Compare May 3, 2021 15:32
@peacekeeper peacekeeper force-pushed the peacekeeper-finalize-resolution-dereferencing branch from d295bd6 to 241315a Compare May 3, 2021 15:36
Comment on lines 270 to 274
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.', () => {
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Comment on lines 290 to 291
it.skip('A conforming DID Method specification MUST guarantee that the canonicalId value is logically equivalent to the id property value.', () => {
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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 () => {
Copy link
Member

@msporny msporny May 3, 2021

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.

Copy link
Member

@msporny msporny left a 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.

@peacekeeper
Copy link
Contributor Author

@msporny I applied your suggestions.

@msporny msporny requested review from clehner and shigeya May 3, 2021 17:36
@@ -0,0 +1,5 @@
export default expected => {
const regex = /^\w+\/[-+.\w]+/
Copy link
Contributor

@OR13 OR13 May 3, 2021

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+......

Copy link
Contributor

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?

Copy link
Contributor Author

@peacekeeper peacekeeper May 5, 2021

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
Copy link
Contributor

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.

Copy link
Contributor Author

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);
Copy link
Contributor

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.

Copy link
Contributor Author

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]+/
Copy link
Contributor

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'));
Copy link
Contributor

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 👍

msporny pushed a commit that referenced this pull request May 6, 2021
@msporny msporny deleted the peacekeeper-finalize-resolution-dereferencing branch June 18, 2021 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants