Skip to content

Commit

Permalink
Updated pubsub tests to test models with custom primary key attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
sgress454 committed Feb 12, 2014
1 parent ce891c5 commit 0cfea4a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ module.exports = {
},

message: function(req, res) {
User.findOne(1, function(err, user) {
User.findOne({user_id:1}, function(err, user) {
User.message(user, {greeting: 'hello'}, req);
res.send(200);
});
},

subscribe: function(req, res) {
User.subscribe(req, {id:req.param('id')}, req.param('context'));
User.subscribe(req, {user_id:req.param('id')}, req.param('context'));
res.send(200);
}

Expand Down
7 changes: 6 additions & 1 deletion test/integration/fixtures/sampleApp/api/models/Pet.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
module.exports = {

autoPK: false,
attributes: {
pet_id: {
type: 'integer',
primaryKey: true,
autoIncrement: true
},
name: 'string',
owner: {
model: 'user',
Expand Down
7 changes: 6 additions & 1 deletion test/integration/fixtures/sampleApp/api/models/User.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
module.exports = {

autoPK: false,
attributes: {
user_id: {
type: 'integer',
primaryKey: true,
autoIncrement: true
},
name: 'string',
pets: {
collection: 'pet',
Expand Down
2 changes: 1 addition & 1 deletion test/integration/pubsub.modelEvents.subscribers.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ describe('pubsub :: ', function() {

});

it ('adding a user to the pet via POST /user/1/pets should result a correct `pet` event being received by all subscribers', function(done) {
it ('adding a user to the pet via POST /user/1/pets should result in a correct `pet` event being received by all subscribers', function(done) {

socket1.on('pet', function(message) {
assert(message.id == 1
Expand Down

0 comments on commit 0cfea4a

Please sign in to comment.