test typescriptification - EventListSummary (#8493)
* test/components/views/elements/EventListSummary-test.js -> tsx Signed-off-by: Kerry Archibald <kerrya@element.io> * add user mocks util Signed-off-by: Kerry Archibald <kerrya@element.io> * lint Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
parent
995d008aca
commit
ce3bc9dc07
3 changed files with 115 additions and 127 deletions
|
@ -53,3 +53,18 @@ export const getMockClientWithEventEmitter = (
|
|||
return mock;
|
||||
};
|
||||
|
||||
export const unmockClientPeg = () => jest.spyOn(MatrixClientPeg, 'get').mockRestore();
|
||||
|
||||
/**
|
||||
* Returns basic mocked client methods related to the current user
|
||||
* ```
|
||||
* const mockClient = getMockClientWithEventEmitter({
|
||||
...mockClientMethodsUser('@mytestuser:domain'),
|
||||
});
|
||||
* ```
|
||||
*/
|
||||
export const mockClientMethodsUser = (userId = '@alice:domain') => ({
|
||||
getUserId: jest.fn().mockReturnValue(userId),
|
||||
isGuest: jest.fn().mockReturnValue(false),
|
||||
mxcUrlToHttp: jest.fn().mockReturnValue('mock-mxcUrlToHttp'),
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue