Stores refactor: convert TypingStore; rename TestStores to TestSdkContext (#9454)
This commit is contained in:
parent
bb0c175b7e
commit
13fbd096b0
7 changed files with 26 additions and 22 deletions
|
@ -27,7 +27,7 @@ import { MatrixDispatcher } from '../../src/dispatcher/dispatcher';
|
|||
import { UPDATE_EVENT } from '../../src/stores/AsyncStore';
|
||||
import { ActiveRoomChangedPayload } from '../../src/dispatcher/payloads/ActiveRoomChangedPayload';
|
||||
import { SpaceStoreClass } from '../../src/stores/spaces/SpaceStore';
|
||||
import { TestStores } from '../TestStores';
|
||||
import { TestSdkContext } from '../TestSdkContext';
|
||||
|
||||
// mock out the injected classes
|
||||
jest.mock('../../src/PosthogAnalytics');
|
||||
|
@ -77,7 +77,7 @@ describe('RoomViewStore', function() {
|
|||
// Make the RVS to test
|
||||
dis = new MatrixDispatcher();
|
||||
slidingSyncManager = new MockSlidingSyncManager();
|
||||
const stores = new TestStores();
|
||||
const stores = new TestSdkContext();
|
||||
stores._SlidingSyncManager = slidingSyncManager;
|
||||
stores._PosthogAnalytics = new MockPosthogAnalytics();
|
||||
stores._SpaceStore = new MockSpaceStore();
|
||||
|
|
|
@ -17,13 +17,14 @@ limitations under the License.
|
|||
import { mocked } from "jest-mock";
|
||||
import { MatrixClient } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { MatrixClientPeg } from "../../src/MatrixClientPeg";
|
||||
import TypingStore from "../../src/stores/TypingStore";
|
||||
import { LOCAL_ROOM_ID_PREFIX } from "../../src/models/LocalRoom";
|
||||
import SettingsStore from "../../src/settings/SettingsStore";
|
||||
import { TestSdkContext } from "../TestSdkContext";
|
||||
|
||||
jest.mock("../../src/settings/SettingsStore", () => ({
|
||||
getValue: jest.fn(),
|
||||
monitorSetting: jest.fn(),
|
||||
}));
|
||||
|
||||
describe("TypingStore", () => {
|
||||
|
@ -37,11 +38,12 @@ describe("TypingStore", () => {
|
|||
const localRoomId = LOCAL_ROOM_ID_PREFIX + "test";
|
||||
|
||||
beforeEach(() => {
|
||||
typingStore = new TypingStore();
|
||||
mockClient = {
|
||||
sendTyping: jest.fn(),
|
||||
} as unknown as MatrixClient;
|
||||
MatrixClientPeg.get = () => mockClient;
|
||||
const context = new TestSdkContext();
|
||||
context.client = mockClient;
|
||||
typingStore = new TypingStore(context);
|
||||
mocked(SettingsStore.getValue).mockImplementation((setting: string) => {
|
||||
return settings[setting];
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue