Browse Source

fixed one test

pull/16/head
Stephen Searles 2 years ago
parent
commit
21caa0f7e4
1 changed files with 10 additions and 5 deletions
  1. 10
    5
      doc_test.go

+ 10
- 5
doc_test.go View File

@@ -35,13 +35,20 @@ func TestEdits(t *testing.T) {
w.CH.NewContent(title, "")

// start an edit session
doc, err := w.CH.editSession(contentPath)
es, err := w.CH.editSession(contentPath)
if err != nil {
t.Fatal("error creating document client:", err)
}

// register an *extra* client that just adds to the received delta slice we're tracking
c := doc.doc.Client(acedoc.DeltaHandlerFunc(func(ds []acedoc.Delta) error {
// register a client that we will use to push the deltas. we dont need
// to actually do anything to receive deltas here, though.
c := es.doc.Client(acedoc.DeltaHandlerFunc(func(ds []acedoc.Delta) error {
return nil
}))

// register an *extra* client that just adds to the received delta
// slice we're tracking
es.doc.Client(acedoc.DeltaHandlerFunc(func(ds []acedoc.Delta) error {
mtx.Lock()
defer mtx.Unlock()
received = append(received, ds...)
@@ -66,8 +73,6 @@ func TestEdits(t *testing.T) {
if len(received) != len(send) {
t.Errorf("expected %d deltas, received %d; expected: %v, received: %v", len(send), len(received), send, received)
}

t.Log(w.CH.Contents())
}

func TestDeltasSingle(t *testing.T) {

Loading…
Cancel
Save