Browse Source

read on drive2 before writing, ensure replication in test

Kieran Gibb 2 years ago
parent
commit
dd069337e1
No known key found for this signature in database
1 changed files with 9 additions and 6 deletions
  1. 9
    6
      test/index.test.js

+ 9
- 6
test/index.test.js View File

@@ -389,13 +389,16 @@ describe('multiwriter', (context) => {
389 389
           assert.error(err, 'no error')
390 390
           replicate(drive, drive2, (err) => {
391 391
             assert.error(err, 'no error')
392
-            writeSecond(() => {
393
-              replicate(drive, drive2, (err) => {
394
-                assert.error(err, 'no error')
395
-                drive.readFile('/hello.txt', (err, data) => {
392
+            drive2.readFile('/hello.txt', (err, data) => {
393
+              assert.same(data, Buffer.from('mundo'), 'gets latest value')
394
+              writeSecond(() => {
395
+                replicate(drive, drive2, (err) => {
396 396
                   assert.error(err, 'no error')
397
-                  assert.same(data, Buffer.from('verden'), 'gets latest value')
398
-                  cleanup([storage1, storage2], next)
397
+                  drive.readFile('/hello.txt', (err, data) => {
398
+                    assert.error(err, 'no error')
399
+                    assert.same(data, Buffer.from('verden'), 'gets latest value')
400
+                    cleanup([storage1, storage2], next)
401
+                  })
399 402
                 })
400 403
               })
401 404
             })