From 1253c768c71708ce5847d5419427b6e1fc19705e Mon Sep 17 00:00:00 2001 From: Bernardo Garces Chapero Date: Thu, 27 Apr 2023 12:39:37 +0200 Subject: [PATCH] Return state when calling EncryptionPublicKeyController.cancelEncryptionPublicKey (#18845) * returns state * adds unit test --- app/scripts/controllers/encryption-public-key.test.ts | 9 +++++++++ app/scripts/controllers/encryption-public-key.ts | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/scripts/controllers/encryption-public-key.test.ts b/app/scripts/controllers/encryption-public-key.test.ts index cc5b61cc1..cb5581831 100644 --- a/app/scripts/controllers/encryption-public-key.test.ts +++ b/app/scripts/controllers/encryption-public-key.test.ts @@ -352,6 +352,15 @@ describe('EncryptionPublicKeyController', () => { 'Cancel', ); }); + + it('returns current state', async () => { + getStateMock.mockReturnValueOnce(stateMock); + expect( + await encryptionPublicKeyController.cancelEncryptionPublicKey( + messageIdMock, + ), + ).toEqual(stateMock); + }); }); describe('message manager events', () => { diff --git a/app/scripts/controllers/encryption-public-key.ts b/app/scripts/controllers/encryption-public-key.ts index 626413b3f..4ea2c1afe 100644 --- a/app/scripts/controllers/encryption-public-key.ts +++ b/app/scripts/controllers/encryption-public-key.ts @@ -275,7 +275,7 @@ export default class EncryptionPublicKeyController extends BaseControllerV2< * @param msgId - The id of the message to cancel. */ cancelEncryptionPublicKey(msgId: string) { - this._cancelAbstractMessage(this._encryptionPublicKeyManager, msgId); + return this._cancelAbstractMessage(this._encryptionPublicKeyManager, msgId); } /**