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

DID Metadata Structure Test (first set) #47

Merged
merged 5 commits into from
Apr 1, 2021

Conversation

shigeya
Copy link
Contributor

@shigeya shigeya commented Mar 30, 2021

This PR contains on-going work for Metadata Structure tests, Issue #31.

Includes most of the tests besides one with dependency with spec registry.

@@ -0,0 +1,61 @@
const didMetadataStructureTest_r = (didDocumentMetadata) => {
describe("didDocumentMetadata", () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

if you can prefix this with the section of the spec that will help us make sure we are covering everything

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a function called from main describe section. For the source-code-wise, prefix might be useful, but if we ran test verbosely, the section number appears multiple times. May let me consider what is the best solution in future commits.

};

const didMetadataStructureTests = (suiteConfig) => {
describe('7.3 Metadata Structure', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe this is sufficient


it('Each property value MUST be a string, map, list, ordered set, boolean, or null.', () => {
Object.keys(didDocumentMetadata).forEach((property_name) => {
expect(typeof didDocumentMetadata[property_name]).toEqual(expect.stringMatching(/(string|object|boolean)/)); // map, list, set and null are objects
Copy link
Contributor

Choose a reason for hiding this comment

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

a bit of a nit, but potentially we can test "list / set" better

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any suggestion welcome. I think we need to have some is-a functions for all of the basic types and consistently use it.

@OR13 OR13 merged commit 60574a8 into w3c:main Apr 1, 2021
@shigeya shigeya deleted the shigeya-did-metadata-structure branch April 2, 2021 22:45
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.

4 participants