w3c / did-test-suite

W3C DID Test Suite and Implementation Report

Home Page:https://w3c.github.io/did-test-suite/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

didMetadataStructureTest_r is not defined

fqutishat opened this issue · comments

    ReferenceError: didMetadataStructureTest_r is not defined

      24 |             Object.keys(didDocumentMetadata).forEach((property_name) => {
      25 |                 if (typeof didDocumentMetadata[property_name] == "object") {
    > 26 |                     didMetadataStructureTest_r(didDocumentMetadata[property_name]);
         |                     ^
      27 |                 }
      28 |             });
      29 |         });

      at forEach (suites/did-core-properties/did-metadata-structure.js:26:21)
          at Array.forEach (<anonymous>)
      at Object.<anonymous> (suites/did-core-properties/did-metadata-structure.js:24:46)

didMetadataStructureTest_r(didDocumentMetadata[property_name]);

@fqutishat Thank you very much for spotting this. This code path is not used unless you run with a metadata property with an object as a value.

If you need to run the test with such a metadata, please rename

didMetadataStructureTest_r

to

didMetadataStructureTest_Map_Recursive

Then, it should work.

I will create PR for the repository.

@fqutishat The current head of the main branch merged the fix. please try.

@msporny Please mark this issue as pending close.

@msporny Please mark this issue as pending close.

We only need to do that on DID Core... we can close issues on the test suite as they're confirmed. All we need is @fqutishat to say you fixed his issue and we can close.

@msporny @shigeya I have this error now. Tests cannot be nested.

 ● 7.3 Metadata Structure - did:orb - DID Orb Test Suite - SecureKey › did:orb:interim:EiC-dLIbtnkHnfc6_Wkc8-X8Ag8FhvpC-jIMrT29_S_ttw › application/did+ld+json › 7.3 Metadata Structure - The values within any complex data structures such as maps and lists MUST be one of these data types as well.

    Tests cannot be nested. Test "7.3 Metadata Structure - The structure used to communicate this metadata MUST be a map of properties." cannot run because it is nested within "7.3 Metadata Structure - The values within any complex data structures such as maps and lists MUST be one of these data types as well.".

      1 | const didMetadataStructureTest_Map_Recursive = (didDocumentMetadata) => {
    > 2 |     it('7.3 Metadata Structure - ' +
        |     ^
      3 |        'The structure used to communicate this metadata MUST be a map of properties.', () => {
      4 |         expect(didDocumentMetadata).toBeInfraMap();
      5 |     });

      at Env.it (node_modules/jest-jasmine2/build/jasmine/Env.js:605:19)
      at didMetadataStructureTest_Map_Recursive (suites/did-core-properties/did-metadata-structure.js:2:5)
      at forEach (suites/did-core-properties/did-metadata-structure.js:26:21)
          at Array.forEach (<anonymous>)
      at Object.<anonymous> (suites/did-core-properties/did-metadata-structure.js:24:46)

@fqutishat Ah, right. I see. I need to find a workaround...

Would you please provide the implementation JSON data you have? via gist.github.com or other ways? then I can fix the problem.

@shigeya Please see PR #117

@troyronda @fqutishat thanks. Will fix it tomorrow Japanese time.

@troyronda @fqutishat PR #122 addressed the above issue.

@shigeya thank you for your fix but now I have new error

   TypeError: expect(...).toBeDidDocumentMap is not a function

      30 |                             Object.keys(didDocumentMetadata).forEach((property_name) => {
      31 |                                 if (typeof didDocumentMetadata[property_name] == "object") {
    > 32 |                                     expect(didDocumentMetadata[property_name]).toBeDidDocumentMap();
         |                                                                                ^
      33 |                                 }
      34 |                             });
      35 |                         });

@fqutishat That's odd. Did you ran lerna run prepare at the top level?

The current main branch (HEAD at 8749150) includes did:orb implementation and not throwing the error.

@shigeya yes it works now after run lerna run prepare at the top level. I will close the issue.