diff --git a/jest.config.cjs b/jest.config.cjs index b8375bdf..721894b5 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -20,4 +20,5 @@ module.exports = { customExportConditions: ['node', 'node-addons'], }, globalSetup: './jest.setup.cjs', + setTimeout: 10000, } diff --git a/src/components/endpoints/__tests__/Permissions.spec.ts b/src/components/endpoints/__tests__/Permissions.spec.ts index 5fe32ca7..89ff44d1 100644 --- a/src/components/endpoints/__tests__/Permissions.spec.ts +++ b/src/components/endpoints/__tests__/Permissions.spec.ts @@ -26,57 +26,59 @@ window.erc725Account = { }, } as Contract -beforeEach(() => { - jest.resetAllMocks() -}) +describe('Setting Permissions tests', () => { + beforeEach(() => { + jest.resetAllMocks() + }) -test('can update permissions for given address', async () => { - setState('address', '0x02f02b27eDFcBBDE762Ff2a7FC20a4Aebd495214') + it('can update permissions for given address', async () => { + setState('address', '0x02f02b27eDFcBBDE762Ff2a7FC20a4Aebd495214') - mockSend.mockImplementation(() => ({ - on: () => ({ - once: () => jest.fn().mockImplementation(() => {}), - }), - })) + mockSend.mockImplementation(() => ({ + on: () => ({ + once: () => jest.fn().mockImplementation(() => {}), + }), + })) - render(Permissions) + render(Permissions) - fireEvent.click(screen.getByTestId('CHANGEOWNER')) - fireEvent.click(screen.getByTestId('setPermissions')) + fireEvent.click(screen.getByTestId('CHANGEOWNER')) + fireEvent.click(screen.getByTestId('setPermissions')) - await waitFor(() => - expect(screen.getByTestId('notification')).toHaveTextContent( - 'Permissions set' + await waitFor(() => + expect(screen.getByTestId('notification')).toHaveTextContent( + 'Permissions set' + ) ) - ) - expect(mockSend).toBeCalledWith( - [ - '0x4b80742de2bf82acb3630000af3bf2ffb025098b79caddfbdd113b3681817744', - '0xdf30dba06db6a30e65354d9a64c609861f089545ca58c6b4dbe31a5f338cb0e3', - '0xdf30dba06db6a30e65354d9a64c6098600000000000000000000000000000007', - ], - [ - '0x0000000000000000000000000000000000000000000000000000000000000001', - '0x00000000000000000000000000000008', - '0xaf3bf2ffb025098b79caddfbdd113b3681817744', - ] - ) -}) + expect(mockSend).toBeCalledWith( + [ + '0x4b80742de2bf82acb3630000af3bf2ffb025098b79caddfbdd113b3681817744', + '0xdf30dba06db6a30e65354d9a64c609861f089545ca58c6b4dbe31a5f338cb0e3', + '0xdf30dba06db6a30e65354d9a64c6098600000000000000000000000000000007', + ], + [ + '0x0000000000000000000000000000000000000000000000000000000000000001', + '0x00000000000000000000000000000008', + '0xaf3bf2ffb025098b79caddfbdd113b3681817744', + ] + ) + }) -test('can see set permission error from send function', async () => { - setState('address', '0x02f02b27eDFcBBDE762Ff2a7FC20a4Aebd495214') + it('can see set permission error from send function', async () => { + setState('address', '0x02f02b27eDFcBBDE762Ff2a7FC20a4Aebd495214') - mockSend.mockImplementation(() => - jest.fn().mockImplementation(() => { - throw new Error('Send error') - })() - ) + mockSend.mockImplementation(() => + jest.fn().mockImplementation(() => { + throw new Error('Send error') + })() + ) - render(Permissions) + render(Permissions) - fireEvent.click(screen.getByTestId('setPermissions')) + fireEvent.click(screen.getByTestId('setPermissions')) - await waitFor(() => - expect(screen.getByTestId('notification')).toHaveTextContent('Send error') - ) + await waitFor(() => + expect(screen.getByTestId('notification')).toHaveTextContent('Send error') + ) + }) })