Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Toktar committed Jul 7, 2022
1 parent 9f34c2a commit bb43f8a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 1 addition & 3 deletions services/diddoc_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,7 @@ func (ds DIDDocService) protoToMap(protoObject protoiface.MessageV1) (orderedmap
if err != nil {
return *mapObj, err
}

// var mapObj map[string]interface{}


err = json.Unmarshal([]byte(jsonObj), &mapObj)
if err != nil {
return *mapObj, err
Expand Down
5 changes: 2 additions & 3 deletions services/diddoc_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ func TestMarshallDID(t *testing.T) {
VerificationMethod: []*cheqd.VerificationMethod{&verificationMethod1, &verificationMethod2},
}

expectedDID := "{\"@context\":[\"test\"],\"id\":\"did:cheqd:mainnet:N22KY2Dyvmuu2PyyqSFKue\",\"verificationMethod\":[{\"controller\":\"did:cheqd:mainnet:N22KY2Dyvmuu2PyyqSFKue\",\"id\":\"did:cheqd:mainnet:N22KY2Dyvmuu2PyyqSFKue#verkey\",\"publicKeyMultibase\":\"zAKJP3f7BD6W4iWEQ9jwndVTCBq8ua2Utt8EEjJ6Vxsf\",\"type\":\"Ed25519VerificationKey2020\"},{\"controller\":\"did:cheqd:mainnet:N22KY2Dyvmuu2PyyqSFKue\",\"id\":\"did:cheqd:mainnet:N22KY2Dyvmuu2PyyqSFKue#verkey\",\"publicKeyJwk\":{\"crv\":\"Ed25519\",\"kty\":\"OKP\",\"x\":\"VCpo2LMLhn6iWku8MKvSLg2ZAoC-nlOyPVQaO3FxVeQ\"},\"type\":\"JsonWebKey2020\"}]}"

expectedDID := "{\"@context\":[\"test\"],\"id\":\"did:cheqd:mainnet:N22KY2Dyvmuu2PyyqSFKue\",\"verificationMethod\":[{\"id\":\"did:cheqd:mainnet:N22KY2Dyvmuu2PyyqSFKue#verkey\",\"type\":\"Ed25519VerificationKey2020\",\"controller\":\"did:cheqd:mainnet:N22KY2Dyvmuu2PyyqSFKue\",\"publicKeyMultibase\":\"zAKJP3f7BD6W4iWEQ9jwndVTCBq8ua2Utt8EEjJ6Vxsf\"},{\"id\":\"did:cheqd:mainnet:N22KY2Dyvmuu2PyyqSFKue#verkey\",\"type\":\"JsonWebKey2020\",\"controller\":\"did:cheqd:mainnet:N22KY2Dyvmuu2PyyqSFKue\",\"publicKeyJwk\":{\"crv\":\"Ed25519\",\"kty\":\"OKP\",\"x\":\"VCpo2LMLhn6iWku8MKvSLg2ZAoC-nlOyPVQaO3FxVeQ\"}}]}"
jsonDID, err := didDocService.MarshallDID(didDoc)

fmt.Println(jsonDID)
require.EqualValues(t, jsonDID, expectedDID)
require.EqualValues(t, expectedDID, jsonDID)
require.Empty(t, err)
}

0 comments on commit bb43f8a

Please sign in to comment.