|
|
@@ -131,6 +131,10 @@ describe('ProjectController', function() {
|
|
|
}
|
|
|
])
|
|
|
|
|
|
+ this.SystemMessageManager = {
|
|
|
+ getMessages: sinon.stub().callsArgWith(0, null, [])
|
|
|
+ }
|
|
|
+
|
|
|
this.ProjectController = SandboxedModule.require(MODULE_PATH, {
|
|
|
globals: {
|
|
|
console: console
|
|
|
@@ -148,6 +152,7 @@ describe('ProjectController', function() {
|
|
|
inc() {}
|
|
|
},
|
|
|
'@overleaf/o-error/http': HttpErrors,
|
|
|
+ '../SystemMessages/SystemMessageManager': this.SystemMessageManager,
|
|
|
'./ProjectDeleter': this.ProjectDeleter,
|
|
|
'./ProjectDuplicator': this.ProjectDuplicator,
|
|
|
'./ProjectCreationHandler': this.ProjectCreationHandler,
|
|
|
@@ -385,6 +390,14 @@ describe('ProjectController', function() {
|
|
|
|
|
|
describe('projectListPage', function() {
|
|
|
beforeEach(function() {
|
|
|
+ this.systemMessages = [
|
|
|
+ { _id: '42', content: 'Hello from the other side!' },
|
|
|
+ { _id: '1337', content: 'Can you read this?' }
|
|
|
+ ]
|
|
|
+ this.SystemMessageManager.getMessages = sinon
|
|
|
+ .stub()
|
|
|
+ .callsArgWith(0, null, this.systemMessages)
|
|
|
+
|
|
|
this.tags = [
|
|
|
{ name: 1, project_ids: ['1', '2', '3'] },
|
|
|
{ name: 2, project_ids: ['a', '1'] },
|
|
|
@@ -456,6 +469,14 @@ describe('ProjectController', function() {
|
|
|
this.ProjectController.projectListPage(this.req, this.res)
|
|
|
})
|
|
|
|
|
|
+ it('should send the systemMessages', function(done) {
|
|
|
+ this.res.render = (pageName, opts) => {
|
|
|
+ opts.systemMessages.should.deep.equal(this.systemMessages)
|
|
|
+ done()
|
|
|
+ }
|
|
|
+ this.ProjectController.projectListPage(this.req, this.res)
|
|
|
+ })
|
|
|
+
|
|
|
it('should create trigger ip matcher notifications', function(done) {
|
|
|
this.settings.overleaf = true
|
|
|
this.res.render = (pageName, opts) => {
|