8000 Tests for socket message validation and errors. by daffl · Pull Request #123 · feathersjs/feathers · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
language: node_js
node_js:
- "0.10"
- "0.11"
- "node"
- "iojs"
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"lib": "lib"
},
"scripts": {
"test": "grunt"
"test": "grunt --stack"
},
"engines": {
"node": ">= 0.10.0",
Expand All @@ -37,8 +37,8 @@
"body-parser": "^1.0.2",
"debug": "^2.1.1",
"express": "^4.0.0",
"feathers-commons": "^0.1.0",
"feathers-errors": ">=0.2.0",
"feathers-commons": "^0.2.0",
"feathers-errors": "^0.2.5",
"lodash": "^3.1.0",
"primus": "^2.4.0",
"primus-emitter": "^3.0.2",
Expand Down
21 changes: 21 additions & 0 deletions test/providers/primus.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,15 @@ describe('Primus provider', function () {
});

describe('Services', function() {
it('invalid arguments cause an error', function (done) {
socket.send('todo::find', 1, {}, function(error) {
assert.equal(error.message, 'Too many arguments for \'find\' service method');
done();
});
});

describe('CRUD', function () {

it('::find', function (done) {
socket.send('todo::find', {}, function (error, data) {
verify.find(data);
Expand Down Expand Up @@ -123,6 +130,20 @@ describe('Primus provider', function () {
});
});

it('::create without parameters and callback', function (done) {
var original = {
name: 'creating'
};

socket.send('todo::create', original);

socket.once('todo created', function(data) {
verify.create(original, data);

done();
});
});

it('::update', function (done) {
var original = {
name: 'updating'
Expand Down
21 changes: 21 additions & 0 deletions test/providers/socketio.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ describe('SocketIO provider', function () {
});

describe('Services', function() {
it('invalid arguments cause an error', function (done) {
socket.emit('todo::find', 1, {}, function(error) {
assert.equal(error.message, 'Too many arguments for \'find\' service method');
done();
});
});

describe('CRUD', function () {
it('::find', function (done) {
socket.emit('todo::find', {}, function (error, data) {
Expand Down Expand Up @@ -121,6 +128,20 @@ describe('SocketIO provider', function () {
});
});

it('::create without parameters and callback', function (done) {
var original = {
name: 'creating'
};

socket.emit('todo::create', original);

socket.once('todo created', function(data) {
verify.create(original, data);

done();
});
});

it('::update', function (done) {
var original = {
name: 'updating'
Expand Down
0