From ad7f3a47cb79f322d86316b47f1e4b43e7be39c4 Mon Sep 17 00:00:00 2001 From: Jim de Beer Date: Fri, 13 Jan 2017 20:41:31 +0100 Subject: [PATCH] remove logs --- lib/client/index.js | 1 - lib/server/incoming.js | 15 +-------------- test/context.js | 22 ++-------------------- test/data-size.js | 1 - test/index.js | 10 +++++----- 5 files changed, 8 insertions(+), 41 deletions(-) diff --git a/lib/client/index.js b/lib/client/index.js index fb7eafc..7377b7a 100644 --- a/lib/client/index.js +++ b/lib/client/index.js @@ -48,7 +48,6 @@ const connect = (hub, url, reconnect) => { socket.onmessage = ({ data }) => { const stamp = bs.create('upstream') - if (hub.id === 'hybrid') console.log('\n\n\n\n', hub.id, 'šŸ¤“ incoming:', JSON.stringify(JSON.parse(data), false, 2)) hub.set(JSON.parse(data), stamp) bs.close(stamp) } diff --git a/lib/server/incoming.js b/lib/server/incoming.js index 0c05c55..546cc3c 100644 --- a/lib/server/incoming.js +++ b/lib/server/incoming.js @@ -30,20 +30,10 @@ export default (hub, socket, data) => { if (payload) { if (meta && meta.resolve) { client.resolve = meta.resolve - if (hub.id === 'scraper') console.log('\n\n', hub.id, '1šŸ‘» incoming:', JSON.stringify(payload, false, 2)) - console.log(t.tStamp) t.set(payload, false) - console.log(t.tStamp) bs.on(() => { client.resolve = false }) } else { - if (hub.id === 'scraper') { - console.log('\n\n', hub.id, '2šŸ‘» incoming:', JSON.stringify(payload, false, 2)) - console.log(hub.subscriptions.map(val => val.id)) - } - console.log(t.tStamp) - // delete t.tStamp t.set(payload, false) - console.log(t.tStamp) } bs.close() } @@ -61,10 +51,7 @@ const create = (hub, socket, meta) => { } const incomingSubscriptions = (hub, client, meta, id) => { - const update = (t, type, subs, tree) => { - // console.log('šŸ² ', hub.id, client.key) - send(hub, client, t, type, subs, tree) - } + const update = (t, type, subs, tree) => send(hub, client, t, type, subs, tree) if (!client.upstreamSubscriptions) client.upstreamSubscriptions = {} for (let key in meta.subscriptions) { let uid = key + '-' + id diff --git a/test/context.js b/test/context.js index 6c8de36..aabd38e 100644 --- a/test/context.js +++ b/test/context.js @@ -1,18 +1,5 @@ const hub = require('../') -// const test = require('tape') - -const test = (label, fn) => { - var cnt = 0 - var x = { - pass: (val) => console.log(val), - end: () => { - cnt++ - console.log('\n\n\n\n-----------------------------\ncompleted cycle --- next!', cnt) - setTimeout(() => fn(x), 100) - } - } - fn(x) -} +const test = require('tape') test('context', t => { const scraper = hub({ @@ -70,8 +57,6 @@ test('context', t => { client2.get('somefield', {}).once('hahaha') ]).then(() => { t.pass('client1 & client2 receive context updates') - // console.log(hybrid.getContext('pavel').keys()) - console.log('\n\n\nšŸ¼ šŸ¤ šŸ¼') client4.set({ smurf: true }) }) @@ -90,10 +75,7 @@ test('context', t => { client3.get('blurf', {}).once('hello').then(() => { t.pass('client3 receives updates after switching context') client1.set({ context: false }) - hybrid.getContext('pavel').clients.once(t => { - console.log('??????', t.keys()) - return t.keys().length === 2 - }) + hybrid.getContext('pavel').clients.once(t => t.keys().length === 2) .then(() => { t.pass('removed client from hybrid') client1.set(null) diff --git a/test/data-size.js b/test/data-size.js index 8bb5ae1..499702c 100644 --- a/test/data-size.js +++ b/test/data-size.js @@ -37,7 +37,6 @@ test('data size', { timeout: 2000 }, t => { server.set({ someData }) client.subscribe({ someData: true }, () => { - console.log('fire') t.ok(true, 'subscription fired') t.end() }) diff --git a/test/index.js b/test/index.js index 9de2f98..ed47015 100644 --- a/test/index.js +++ b/test/index.js @@ -1,9 +1,9 @@ if (typeof window === 'undefined') { require('source-map-support').install() } -// require('./connect') -// require('./multiple') -// require('./data-size') -// require('./switch') +require('./connect') +require('./multiple') +require('./data-size') +require('./switch') require('./context') -// require('./types') +require('./types')