mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-26 09:22:08 +00:00
Merge branch 'master' into pr-remove-by-key
# Conflicts: # test/unit/coffee/NotificationsTests.coffee
This commit is contained in:
commit
7bb6e6e18c
2 changed files with 8 additions and 5 deletions
|
@ -31,6 +31,8 @@ module.exports = (grunt) ->
|
||||||
unit:
|
unit:
|
||||||
options:
|
options:
|
||||||
reporter: grunt.option('reporter') or 'spec'
|
reporter: grunt.option('reporter') or 'spec'
|
||||||
|
grep: grunt.option("grep")
|
||||||
|
|
||||||
src: ["test/unit/js/**/*.js"]
|
src: ["test/unit/js/**/*.js"]
|
||||||
|
|
||||||
grunt.loadNpmTasks 'grunt-contrib-coffee'
|
grunt.loadNpmTasks 'grunt-contrib-coffee'
|
||||||
|
|
|
@ -18,7 +18,6 @@ describe 'Notifications Tests', ->
|
||||||
@insertStub = sinon.stub()
|
@insertStub = sinon.stub()
|
||||||
@countStub = sinon.stub()
|
@countStub = sinon.stub()
|
||||||
@updateStub = sinon.stub()
|
@updateStub = sinon.stub()
|
||||||
|
|
||||||
@mongojs = =>
|
@mongojs = =>
|
||||||
notifications:
|
notifications:
|
||||||
update: self.mongojsUpdate
|
update: self.mongojsUpdate
|
||||||
|
@ -37,11 +36,11 @@ describe 'Notifications Tests', ->
|
||||||
@stubbedNotificationArray = [@stubbedNotification]
|
@stubbedNotificationArray = [@stubbedNotification]
|
||||||
|
|
||||||
describe 'getUserNotifications', ->
|
describe 'getUserNotifications', ->
|
||||||
it "should find all notifications and return it", (done)->
|
it "should find all notifications and return i", (done)->
|
||||||
@findStub.callsArgWith(1, null, @stubbedNotificationArray)
|
@findStub.callsArgWith(1, null, @stubbedNotificationArray)
|
||||||
@notifications.getUserNotifications user_id, (err, notifications)=>
|
@notifications.getUserNotifications user_id, (err, notifications)=>
|
||||||
notifications.should.equal @stubbedNotificationArray
|
notifications.should.equal @stubbedNotificationArray
|
||||||
@findStub.calledWith({"user_id" : ObjectId(user_id), "templateKey": {"$exists":true}}).should.equal true
|
assert.deepEqual(@findStub.args[0][0], {"user_id" :ObjectId(user_id), "templateKey": {"$exists":true}})
|
||||||
done()
|
done()
|
||||||
|
|
||||||
describe 'addNotification', ->
|
describe 'addNotification', ->
|
||||||
|
@ -114,7 +113,8 @@ describe 'Notifications Tests', ->
|
||||||
_id:ObjectId(notification_id)
|
_id:ObjectId(notification_id)
|
||||||
updateOperation =
|
updateOperation =
|
||||||
"$unset": {templateKey:true, messageOpts:true}
|
"$unset": {templateKey:true, messageOpts:true}
|
||||||
@updateStub.calledWith(searchOps, updateOperation).should.equal true
|
assert.deepEqual(@updateStub.args[0][0], searchOps)
|
||||||
|
assert.deepEqual(@updateStub.args[0][1], updateOperation)
|
||||||
done()
|
done()
|
||||||
|
|
||||||
describe 'removeNotificationKey', ->
|
describe 'removeNotificationKey', ->
|
||||||
|
@ -139,5 +139,6 @@ describe 'Notifications Tests', ->
|
||||||
key: notification_key
|
key: notification_key
|
||||||
updateOperation =
|
updateOperation =
|
||||||
"$unset": {templateKey:true}
|
"$unset": {templateKey:true}
|
||||||
@updateStub.calledWith(searchOps, updateOperation).should.equal true
|
assert.deepEqual(@updateStub.args[0][0], searchOps)
|
||||||
|
assert.deepEqual(@updateStub.args[0][1], updateOperation)
|
||||||
done()
|
done()
|
||||||
|
|
Loading…
Add table
Reference in a new issue