initial test suite

This commit is contained in:
Marcelo Pires
2018-09-06 17:59:56 +02:00
parent b6e6a9cee8
commit db6b6c3848
5 changed files with 178 additions and 10 deletions

24
test/server.js Normal file
View File

@ -0,0 +1,24 @@
var http = require('http'),
faye = require('faye');
var server = http.createServer(),
bayeux = new faye.NodeAdapter({mount: '/faye', timeout: 45});
var unauthorized = [
'/unauthorized',
];
bayeux.addExtension({
incoming: function (message, callback) {
if (message.channel === '/meta/subscribe') {
console.log(message)
if (unauthorized.indexOf(message.subscription) >= 0) {
message.error = '500::unauthorized channel';
}
}
callback(message);
}
});
bayeux.attach(server);
server.listen(8000);