Created
June 23, 2015 00:32
-
-
Save shrop/536979155d253009db80 to your computer and use it in GitHub Desktop.
logActivity Jasmine test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('logActivity server method', function() { | |
it('saves an activity document to the posts collection', function() { | |
// Get the testuser document. | |
testUser = Meteor.users.findOne( { 'profile.userName': 'testuser' } ); | |
// Mock Meteor.userId(). | |
spyOn(Meteor, 'userId').and.returnValue(testUser._id); | |
// Mock inserts for activity. | |
spyOn(Activity, 'insert'); | |
type = 'post'; | |
sourceId = '45B7E9XDWgm9ZKXdv'; | |
Meteor.call('logActivity', type, sourceId); | |
expect(Activity.insert).toHaveBeenCalledWith({ | |
type: 'post', | |
sourceId: '45B7E9XDWgm9ZKXdv', | |
userId: testUser._id, | |
timestamp: new Date() | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment