Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

rm test/persist.js this functionality is covered in scuttlebutt

  • Loading branch information...
commit eed1bba1d5f442191b70c79532e63914840c7816 1 parent 42df9ea
@dominictarr authored
Showing with 0 additions and 91 deletions.
  1. +0 −91 test/persist.js
View
91 test/persist.js
@@ -1,91 +0,0 @@
-var crdt = require('..')
-var es = require('event-stream')
-var assert = require('assertions')
-var help = require('./helpers')
-
-var randomUpdates = help.randomUpdates
-var clone = help.clone
-var validateUpdates = help.validateUpdates
-
-var next = process.nextTick
-
-function test(n,t) {
- exports[n] = t
-}
-
-test('simple', function (t) {
-
- var a = new crdt.Doc()
-
- randomUpdates(a)
- console.log('simple')
-
- a.createReadStream({wrapper: 'raw', tail: false})
- .pipe(es.writeArray(function (err, array) {
- console.log('array', array)
- array.forEach(function(v, i) {
- if(!i)
- assert.equal(v, a.id)
- })
- var sync = false
- var b = new crdt.Doc()
- var reader = es.readArray(array)
- reader
- .pipe(b.createWriteStream({wrapper: 'raw'}))
-
- reader.on('end', function () {
- assert.equal(a.id, b.id)
- assert.deepEqual(a.toJSON(), b.toJSON())
- console.log(b.toJSON())
-
- assert.ok(b.sync)
- assert.ok(sync)
- t.end()
- })
-
- b.on('sync', function () {
- sync = true
- })
-
- }))
-})
-
-test('JSON', function (t) {
-
- var a = new crdt.Doc()
-
- randomUpdates(a)
-
- a.createReadStream({wrapper: 'json', tail: false})
- .pipe(es.writeArray(function (err, array) {
- console.log('array', array)
- array.forEach(function(v, i) {
- console.log(v)
- v = JSON.parse(v)
- if(!i)
- assert.equal(v, a.id)
- })
- var sync = false
- var b = new crdt.Doc()
- var reader = es.readArray(array)
- reader
- .pipe(b.createWriteStream({wrapper: 'json'}))
-
- reader.on('end', function () {
- assert.equal(a.id, b.id)
- assert.deepEqual(a.toJSON(), b.toJSON())
- console.log(b.toJSON())
-
- assert.ok(b.sync)
- assert.ok(sync)
- t.end()
- })
-
- b.on('sync', function () {
- sync = true
- })
-
- }))
-})
-
-
Please sign in to comment.
Something went wrong with that request. Please try again.