mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 06:03:45 +01:00
Merge pull request #16545 from overleaf/dp-project-owner-delete-labels
Allow project owners to delete history labels GitOrigin-RevId: 16111337681ac4085db2cf48e9d4c2fa87993b77
This commit is contained in:
@@ -45,6 +45,7 @@ describe('HttpController', function () {
|
||||
this.LabelsManager = {
|
||||
createLabel: sinon.stub(),
|
||||
deleteLabel: sinon.stub().yields(),
|
||||
deleteLabelForUser: sinon.stub().yields(),
|
||||
getLabels: sinon.stub(),
|
||||
}
|
||||
this.HistoryApiManager = {
|
||||
@@ -75,6 +76,7 @@ describe('HttpController', function () {
|
||||
})
|
||||
this.pathname = 'doc-id-123'
|
||||
this.projectId = new ObjectId().toString()
|
||||
this.projectOwnerId = new ObjectId().toString()
|
||||
this.next = sinon.stub()
|
||||
this.userId = new ObjectId().toString()
|
||||
this.now = Date.now()
|
||||
@@ -473,7 +475,7 @@ describe('HttpController', function () {
|
||||
})
|
||||
})
|
||||
|
||||
describe('deleteLabel', function () {
|
||||
describe('deleteLabelForUser', function () {
|
||||
beforeEach(function () {
|
||||
this.req = {
|
||||
params: {
|
||||
@@ -482,12 +484,34 @@ describe('HttpController', function () {
|
||||
label_id: (this.label_id = new ObjectId()),
|
||||
},
|
||||
}
|
||||
this.HttpController.deleteLabelForUser(this.req, this.res, this.next)
|
||||
})
|
||||
|
||||
it('should delete a label for a project', function () {
|
||||
this.LabelsManager.deleteLabelForUser
|
||||
.calledWith(this.projectId, this.userId, this.label_id)
|
||||
.should.equal(true)
|
||||
})
|
||||
|
||||
it('should return 204', function () {
|
||||
this.res.sendStatus.calledWith(204).should.equal(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe('deleteLabel', function () {
|
||||
beforeEach(function () {
|
||||
this.req = {
|
||||
params: {
|
||||
project_id: this.projectId,
|
||||
label_id: (this.label_id = new ObjectId()),
|
||||
},
|
||||
}
|
||||
this.HttpController.deleteLabel(this.req, this.res, this.next)
|
||||
})
|
||||
|
||||
it('should create a label for a project', function () {
|
||||
it('should delete a label for a project', function () {
|
||||
this.LabelsManager.deleteLabel
|
||||
.calledWith(this.projectId, this.userId, this.label_id)
|
||||
.calledWith(this.projectId, this.label_id)
|
||||
.should.equal(true)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user