From 22caae4db01e5287e92f8c445910784bc13d5b66 Mon Sep 17 00:00:00 2001 From: Wout Slakhorst Date: Tue, 18 Jun 2024 10:08:58 +0200 Subject: [PATCH] added some test assertions --- vdr/sql/did_document_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/vdr/sql/did_document_test.go b/vdr/sql/did_document_test.go index b5c807d958..5ea55ea5d6 100644 --- a/vdr/sql/did_document_test.go +++ b/vdr/sql/did_document_test.go @@ -53,6 +53,7 @@ func TestSqlDIDDocumentManager_CreateOrUpdate(t *testing.T) { assert.Equal(t, "did:web:example.com:iam:alice#1", doc.ID) assert.Equal(t, alice.String(), doc.DID.ID) assert.Equal(t, "alice", doc.DID.Subject) + assert.Equal(t, "did:web:example.com:iam:alice", doc.DidID) }) t.Run("with method and services", func(t *testing.T) { tx := transaction(t, db) @@ -61,8 +62,12 @@ func TestSqlDIDDocumentManager_CreateOrUpdate(t *testing.T) { doc, err := docManager.CreateOrUpdate(sqlDidBob, []SqlVerificationMethod{vm}, []SqlService{service}) require.NoError(t, err) - assert.Len(t, doc.VerificationMethods, 1) - assert.Len(t, doc.Services, 1) + require.Len(t, doc.VerificationMethods, 1) + require.Len(t, doc.Services, 1) + assert.Equal(t, "did:web:example.com:iam:bob#1", doc.VerificationMethods[0].DIDDocumentID) + assert.Equal(t, "did:web:example.com:iam:bob#1", doc.Services[0].DIDDocumentID) + assert.Equal(t, []byte("{}"), doc.VerificationMethods[0].Data) + assert.Equal(t, []byte("{}"), doc.Services[0].Data) }) t.Run("update", func(t *testing.T) { tx := db.Begin()