Commit 6c6b3aeb35148f475c0f590a5bcbe2288be61d5e
reinstate test scripts
Dominic Tarr committed on 7/20/2017, 10:52:53 AMParent: fa58d4f5bea71330ad5e843183c2e5dd8900cd63
Files changed
irc.js | changed |
ssb.js | changed |
irc.js | |||
---|---|---|---|
@@ -46,32 +46,32 @@ | |||
46 | 46 … | irc.say(nick, message) | |
47 | 47 … | } | |
48 | 48 … | ||
49 | 49 … | ||
50 | -//if(!module.parent) { | ||
51 | -// var ssb = require('./ssb') | ||
52 | -// var irc = IRC({}, function (err) { | ||
53 | -// var note = { | ||
54 | -// author: 'dominic', | ||
55 | -// target: 'domanic', | ||
56 | -// text: 'test 1 2 3, @domanic', | ||
57 | -// id: '%v6y1c1VYXthYbNYh0RqmXfC18HyhHnozDN3ZhrWLThU=.sha256' | ||
58 | -// } | ||
59 | -// var config = {} | ||
60 | -// | ||
61 | -// function notify (note) { | ||
62 | -// irc.say( | ||
63 | -// note.type == 'channel' | ||
64 | -// ? IRC.toChannel(note.target) | ||
65 | -// : note.target | ||
66 | -// , | ||
67 | -// ssb.render(note, ssb.link(note.id, config)) | ||
68 | -// ) | ||
69 | -// } | ||
70 | -// | ||
71 | -// notify(note) | ||
72 | -// }) | ||
73 | -//} | ||
74 | -// | ||
50 … | +if(!module.parent) { | ||
51 … | + var ssb = require('./ssb') | ||
52 … | + var irc = IRC({}, function (err) { | ||
53 … | + var note = { | ||
54 … | + author: 'dominic', | ||
55 … | + target: 'domanic', | ||
56 … | + text: 'test 1 2 3, @domanic', | ||
57 … | + id: '%v6y1c1VYXthYbNYh0RqmXfC18HyhHnozDN3ZhrWLThU=.sha256' | ||
58 … | + } | ||
59 … | + var config = {} | ||
75 | 60 … | ||
61 … | + function notify (note) { | ||
62 … | + irc.say( | ||
63 … | + note.type == 'channel' | ||
64 … | + ? IRC.toChannel(note.target) | ||
65 … | + : note.target | ||
66 … | + , | ||
67 … | + ssb.render(note, ssb.link(note.id, config)) | ||
68 … | + ) | ||
69 … | + } | ||
76 | 70 … | ||
71 … | + notify(note) | ||
72 … | + }) | ||
73 … | +} | ||
77 | 74 … | ||
75 … | + | ||
76 … | + | ||
77 … | + |
ssb.js | ||
---|---|---|
@@ -175,29 +175,28 @@ | ||
175 | 175 … | exports.link = function (id, config) { |
176 | 176 … | return ((config && config.irc && config.irc.domain) || "http://viewer.scuttlebot.io") + '/' + encodeURIComponent(id) |
177 | 177 … | } |
178 | 178 … | |
179 | -//if(!module.parent) { | |
180 | -// //this is just for testing... | |
181 | -// require('ssb-client')(function (err, sbot) { | |
182 | -// if(err) throw err | |
183 | -// var state = init(sbot, process.argv[2] || sbot.id, function (err, state) { | |
184 | -// | |
185 | -// console.log(state) | |
186 | -// //XXX: properly persist state with a flumeview? | |
187 | -// | |
188 | -// pull( | |
189 | -// sbot.createLogStream({}), | |
190 | -// pull.drain(function (msg) { | |
191 | -// if(msg.sync) return | |
192 | -// var a = tests.reduce(function (found, test) { | |
193 | -// return found.concat(exports.match(state, msg) || []) | |
194 | -// }, []) | |
195 | -// if(a.length) { | |
196 | -// | |
197 | -// } | |
198 | -// }) | |
199 | -// ) | |
200 | -// }) | |
201 | -// }) | |
202 | -//} | |
203 | -// | |
179 … | +if(!module.parent) { | |
180 … | + //this is just for testing... | |
181 … | + require('ssb-client')(function (err, sbot) { | |
182 … | + if(err) throw err | |
183 … | + var state = init(sbot, process.argv[2] || sbot.id, function (err, state) { | |
184 … | + | |
185 … | + //XXX: properly persist state with a flumeview? | |
186 … | + console.log(state) | |
187 … | + pull( | |
188 … | + sbot.createLogStream({live: true, old: false}), | |
189 … | + pull.drain(function (msg) { | |
190 … | + if(msg.sync) return | |
191 … | + var a = exports.match(state, msg) | |
192 … | + if(a.length) { | |
193 … | + console.log(a) | |
194 … | + } | |
195 … | + }) | |
196 … | + ) | |
197 … | + }) | |
198 … | + }) | |
199 … | +} | |
200 … | + | |
201 … | + | |
202 … | + |
Built with git-ssb-web