Skip to content

Commit

Permalink
added test for $test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim de Beer committed Sep 23, 2016
1 parent 0033ca3 commit ff6294e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
3 changes: 0 additions & 3 deletions lib/serialize/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
const merge = require('lodash.merge') // use a simple merge, start some perf benchmarks

module.exports = function serialize (data, state, type, stamp, subs) {

// console.log('serlize')

const obj = {}
const path = state.realPath(false, true)
const len = path.length
Expand Down
30 changes: 15 additions & 15 deletions test/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ test('context', function (t) {
animal: {
$test: {
exec: (state) => {
console.log(state.root.id, state.root.context, state.val)
return state && state.compute() === 'dog'
},
$pass: {
Expand Down Expand Up @@ -193,27 +192,28 @@ test('context', function (t) {
}).then(() => {
t.ok(true, 'set origin field "james" to "hello" updates all')

console.log('send to server')
server.set({
animal: {
val: 'james',
diet: 'coffee'
}
})

setTimeout(() => {
t.same(clients.map(client => client.animal), clients.map(() => undefined), 'does not send animal "james"')
// server.set({
// animal: {
// val: 'dog',
// diet: 'coffee'
// }
// })

// getAll('animal.diet', 'coffee').then(() => {
// console.log('yo')
// })
}, 500)
return new Promise(resolve => {
setTimeout(() => {
t.same(clients.map(client => client.animal), clients.map(() => undefined), 'does not send animal "james"')
server.set({
animal: {
val: 'dog',
diet: 'coffee'
}
})
getAll('animal.diet', 'coffee').then(() => {
t.ok(true, 'send animal when its a dog')
resolve()
})
}, 500)
})
})
.then(end).catch(err => console.log(err))
// make more complex subs after this one
Expand Down

0 comments on commit ff6294e

Please sign in to comment.