You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
737 B
27 lines
737 B
var ws = require('./') |
|
var test = require('tape') |
|
|
|
test('echo works', function(t) { |
|
var stream = ws('ws://localhost:8343') |
|
stream.on('data', function(o) { |
|
t.ok(Buffer.isBuffer(o), 'is buffer') |
|
t.equal(o.toString(), 'hello', 'got hello back') |
|
stream.destroy() |
|
t.end() |
|
}) |
|
stream.write(new Buffer('hello')) |
|
}) |
|
|
|
test('echo works two times', function(t) { |
|
var stream = ws('ws://localhost:8343') |
|
stream.once('data', function(o) { |
|
t.equal(o.toString(), 'hello', 'got first hello back') |
|
stream.write(new Buffer('hello')) |
|
stream.once('data', function(o) { |
|
t.equal(o.toString(), 'hello', 'got second hello back') |
|
stream.destroy() |
|
t.end() |
|
}) |
|
}) |
|
stream.write(new Buffer('hello')) |
|
})
|
|
|