mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 22:23:42 +01:00
[web] update notification preferences on ownership transfer (#33854)
GitOrigin-RevId: c20c7f992d9dbdd6e9f80feafc7b53587c122dd7
This commit is contained in:
@@ -85,6 +85,13 @@ describe('OwnershipTransferHandler', function () {
|
||||
canAddXEditCollaborators: sinon.stub().resolves(true),
|
||||
},
|
||||
}
|
||||
ctx.Modules = {
|
||||
promises: {
|
||||
hooks: {
|
||||
fire: sinon.stub().resolves(),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
vi.mock('../../../../app/src/Features/Errors/Errors.js', () =>
|
||||
vi.importActual('../../../../app/src/Features/Errors/Errors.js')
|
||||
@@ -148,6 +155,10 @@ describe('OwnershipTransferHandler', function () {
|
||||
})
|
||||
)
|
||||
|
||||
vi.doMock('../../../../app/src/infrastructure/Modules.mjs', () => ({
|
||||
default: ctx.Modules,
|
||||
}))
|
||||
|
||||
ctx.handler = (await import(MODULE_PATH)).default
|
||||
})
|
||||
|
||||
@@ -510,6 +521,19 @@ describe('OwnershipTransferHandler', function () {
|
||||
)
|
||||
})
|
||||
|
||||
it('should fire the ownershipTransferred hook', async function (ctx) {
|
||||
await ctx.handler.promises.transferOwnership(
|
||||
ctx.project._id,
|
||||
ctx.collaborator._id
|
||||
)
|
||||
expect(ctx.Modules.promises.hooks.fire).to.have.been.calledWith(
|
||||
'projectOwnershipTransferred',
|
||||
ctx.project._id,
|
||||
ctx.user._id,
|
||||
ctx.collaborator._id
|
||||
)
|
||||
})
|
||||
|
||||
it('should decline to transfer ownership to a non-collaborator', async function (ctx) {
|
||||
ctx.project.collaberator_refs = []
|
||||
ctx.project.readOnly_refs = []
|
||||
|
||||
Reference in New Issue
Block a user