Documentation and symbolic constants for dispatcher actions (#31278)
* Remove unreachable code `view_last_screen` is never used. * Remove unused action `user_activity_started` Nothing listens to this, so it's pointless. * Symbolic constant for `Action.UserActivity` * Define symbolic constants for more `Action`s Constants for some actions that are emitted by `Lifecycle`
This commit is contained in:
committed by
GitHub
parent
c203f02731
commit
1285b73be6
@@ -547,11 +547,11 @@ describe("<MatrixChat />", () => {
|
||||
getComponent({ realQueryParams });
|
||||
|
||||
defaultDispatcher.dispatch({
|
||||
action: "will_start_client",
|
||||
action: Action.WillStartClient,
|
||||
});
|
||||
// client successfully started
|
||||
await waitFor(() =>
|
||||
expect(defaultDispatcher.dispatch).toHaveBeenCalledWith({ action: "client_started" }),
|
||||
expect(defaultDispatcher.dispatch).toHaveBeenCalledWith({ action: Action.ClientStarted }),
|
||||
);
|
||||
|
||||
// set up keys screen is rendered
|
||||
@@ -1172,10 +1172,10 @@ describe("<MatrixChat />", () => {
|
||||
getComponent({ realQueryParams });
|
||||
|
||||
defaultDispatcher.dispatch({
|
||||
action: "will_start_client",
|
||||
action: Action.WillStartClient,
|
||||
});
|
||||
await waitFor(() =>
|
||||
expect(defaultDispatcher.dispatch).toHaveBeenCalledWith({ action: "client_started" }),
|
||||
expect(defaultDispatcher.dispatch).toHaveBeenCalledWith({ action: Action.ClientStarted }),
|
||||
);
|
||||
|
||||
// Then we are not allowed in - we are being asked to verify
|
||||
@@ -1568,7 +1568,7 @@ describe("<MatrixChat />", () => {
|
||||
it("should continue to post login setup when no session is found in local storage", async () => {
|
||||
getComponent({ realQueryParams });
|
||||
defaultDispatcher.dispatch({
|
||||
action: "will_start_client",
|
||||
action: Action.WillStartClient,
|
||||
});
|
||||
|
||||
// set up keys screen is rendered
|
||||
@@ -1828,7 +1828,7 @@ describe("<MatrixChat />", () => {
|
||||
|
||||
getComponent({});
|
||||
defaultDispatcher.dispatch({
|
||||
action: "will_start_client",
|
||||
action: Action.WillStartClient,
|
||||
});
|
||||
await flushPromises();
|
||||
mockClient.emit(CryptoEvent.KeyBackupFailed, "error code");
|
||||
@@ -1851,7 +1851,7 @@ describe("<MatrixChat />", () => {
|
||||
|
||||
getComponent({});
|
||||
defaultDispatcher.dispatch({
|
||||
action: "will_start_client",
|
||||
action: Action.WillStartClient,
|
||||
});
|
||||
await flushPromises();
|
||||
mockClient.emit(CryptoEvent.KeyBackupFailed, "error code");
|
||||
|
||||
@@ -14,6 +14,7 @@ import { Container, WidgetLayoutStore } from "../../../src/stores/widgets/Widget
|
||||
import { stubClient } from "../../test-utils";
|
||||
import defaultDispatcher from "../../../src/dispatcher/dispatcher";
|
||||
import SettingsStore from "../../../src/settings/SettingsStore";
|
||||
import { Action } from "../../../src/dispatcher/actions.ts";
|
||||
|
||||
// setup test env values
|
||||
const roomId = "!room:server";
|
||||
@@ -196,12 +197,7 @@ describe("WidgetLayoutStore", () => {
|
||||
|
||||
it("should clear the layout if the client is not viable", () => {
|
||||
store.recalculateRoom(mockRoom);
|
||||
defaultDispatcher.dispatch(
|
||||
{
|
||||
action: "on_client_not_viable",
|
||||
},
|
||||
true,
|
||||
);
|
||||
defaultDispatcher.dispatch({ action: Action.ClientNotViable }, true);
|
||||
|
||||
expect(store.getContainerWidgets(mockRoom, Container.Top)).toEqual([]);
|
||||
expect(store.getContainerWidgets(mockRoom, Container.Center)).toEqual([]);
|
||||
|
||||
@@ -132,7 +132,7 @@ describe("ElectronPlatform", () => {
|
||||
new ElectronPlatform();
|
||||
dispatcher.dispatch(
|
||||
{
|
||||
action: "client_started",
|
||||
action: Action.ClientStarted,
|
||||
},
|
||||
true,
|
||||
);
|
||||
|
||||
@@ -15,6 +15,7 @@ import { setupLanguageMock } from "../../../setup/setupLanguage";
|
||||
import ToastStore from "../../../../src/stores/ToastStore.ts";
|
||||
import defaultDispatcher from "../../../../src/dispatcher/dispatcher.ts";
|
||||
import { emitPromise } from "../../../test-utils";
|
||||
import { Action } from "../../../../src/dispatcher/actions.ts";
|
||||
|
||||
fetchMock.config.overwriteRoutes = true;
|
||||
|
||||
@@ -49,7 +50,7 @@ describe("WebPlatform", () => {
|
||||
};
|
||||
new WebPlatform();
|
||||
|
||||
defaultDispatcher.dispatch({ action: "client_started" });
|
||||
defaultDispatcher.dispatch({ action: Action.ClientStarted });
|
||||
await emitPromise(ToastStore.sharedInstance(), "update");
|
||||
const toasts = ToastStore.sharedInstance().getToasts();
|
||||
expect(toasts).toHaveLength(1);
|
||||
|
||||
Reference in New Issue
Block a user