Skip to content

Commit

Permalink
finalize reference field merge test
Browse files Browse the repository at this point in the history
  • Loading branch information
mstdokumaci committed Jul 21, 2017
1 parent df3c999 commit c779abe
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions test/references.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const hub = require('../')
const test = require('tape')

/*
test('references', t => {
const scraper = hub({
_uid_: 'scraper',
Expand Down Expand Up @@ -93,9 +92,10 @@ test('circular references', t => {
})
}, 100)
})
*/

test('reference field merge', { timeout: 1e3 }, t => {
t.plan(8)

const server = hub({
_uid_: 'server',
port: 6061,
Expand Down Expand Up @@ -161,12 +161,10 @@ test('reference field merge', { timeout: 1e3 }, t => {
}
})

// client.subscribe(true)

client.get(['list', 'i3', 'items', 'sub', 'tf'], {}).once('tv')
.then(() => {
client.set({ list: {
i1: { items: { sub1: { bf: false } }, pf: false, other: 'first' },
i1: { items: { sub1: { bf: false } }, pf: false },
i2: { first: false },
i4: { sub: { bf: true } }
} })
Expand All @@ -192,9 +190,11 @@ test('reference field merge', { timeout: 1e3 }, t => {
client.get(['list', 'i1', 'items', 'sub1', 'bf', 'compute']), false,
'i1 sub1 branch field is correct'
)
// i1 pf override won't get synced back
// because it's out of subscription range
t.equals(
client.get(['list', 'i1', 'pf', 'compute']), false,
'i1 props field override is correct'
client.get(['list', 'i1', 'pf', 'compute']), 'pv',
'i1 props field override is not there'
)
t.equals(
client.get(['list', 'i2', 'first', 'compute']), false,
Expand Down Expand Up @@ -227,6 +227,5 @@ test('reference field merge', { timeout: 1e3 }, t => {
)
server.set(null)
client.set(null)
t.end()
})
})

0 comments on commit c779abe

Please sign in to comment.