diff --git a/app/scripts/controllers/permissions/specifications.js b/app/scripts/controllers/permissions/specifications.js index abae2f67d..42f685bfb 100644 --- a/app/scripts/controllers/permissions/specifications.js +++ b/app/scripts/controllers/permissions/specifications.js @@ -61,9 +61,7 @@ export const getCaveatSpecifications = ({ getIdentities }) => { decorator: (method, caveat) => { return async (args) => { const result = await method(args); - return result - .filter((account) => caveat.value.includes(account)) - .slice(0, 1); + return result.filter((account) => caveat.value.includes(account)); }; }, diff --git a/app/scripts/controllers/permissions/specifications.test.js b/app/scripts/controllers/permissions/specifications.test.js index 7c6cae97a..f716ddaba 100644 --- a/app/scripts/controllers/permissions/specifications.test.js +++ b/app/scripts/controllers/permissions/specifications.test.js @@ -46,7 +46,7 @@ describe('PermissionController specifications', () => { describe('restrictReturnedAccounts', () => { describe('decorator', () => { - it('returns the first array member included in the caveat value', async () => { + it('only returns array members included in the caveat value', async () => { const getIdentities = jest.fn(); const { decorator } = getCaveatSpecifications({ getIdentities })[ CaveatTypes.restrictReturnedAccounts @@ -55,10 +55,10 @@ describe('PermissionController specifications', () => { const method = async () => ['0x1', '0x2', '0x3']; const caveat = { type: CaveatTypes.restrictReturnedAccounts, - value: ['0x1', '0x2'], + value: ['0x1', '0x3'], }; const decorated = decorator(method, caveat); - expect(await decorated()).toStrictEqual(['0x1']); + expect(await decorated()).toStrictEqual(['0x1', '0x3']); }); it('returns an empty array if no array members are included in the caveat value', async () => {