diff --git a/data/document.go b/data/document.go index 4fbabcac..ca52f7f5 100644 --- a/data/document.go +++ b/data/document.go @@ -37,6 +37,7 @@ func NewDocument( thread threadmodels.Thread, stateProvider InitialStateProvider, accountData *AccountData) *Document { + decoder := threadmodels.NewEd25519Decoder() return &Document{ thread: thread, diff --git a/data/document_test.go b/data/document_test.go new file mode 100644 index 00000000..b3abc82b --- /dev/null +++ b/data/document_test.go @@ -0,0 +1,28 @@ +package data + +import ( + "github.com/stretchr/testify/assert" + "testing" + + "github.com/anytypeio/go-anytype-infrastructure-experiments/data/threadbuilder" +) + +func TestDocument_Build(t *testing.T) { + thread, err := threadbuilder.NewThreadBuilderFromFile("threadbuilder/userjoinexample.yml") + if err != nil { + t.Fatal(err) + } + keychain := thread.GetKeychain() + accountData := &AccountData{ + Identity: keychain.GetIdentity("A"), + EncKey: keychain.EncryptionKeys["A"], + } + doc := NewDocument(thread, NewPlainTextDocumentStateProvider(), accountData) + res, err := doc.Build() + if err != nil { + t.Fatal(err) + } + + st := res.(*PlainTextDocumentState) + assert.Equal(t, st.Text, "some text|first") +}