-
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
DID Metadata Structure Test (first set) #47
Conversation
@@ -0,0 +1,61 @@ | |||
const didMetadataStructureTest_r = (didDocumentMetadata) => { | |||
describe("didDocumentMetadata", () => { |
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.
if you can prefix this with the section of the spec that will help us make sure we are covering everything
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'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', () => { |
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.
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 |
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.
a bit of a nit, but potentially we can test "list / set" better
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.
Any suggestion welcome. I think we need to have some is-a functions for all of the basic types and consistently use it.
This PR contains on-going work for Metadata Structure tests, Issue #31.
Includes most of the tests besides one with dependency with spec registry.