You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-08-07 21:23:00 +03:00
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:
@@ -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'),
|
||||
});
|
||||
|
Reference in New Issue
Block a user