fix(fe): fix utest issues

This commit is contained in:
hexxa 2021-10-17 20:11:10 +08:00 committed by Hexxa
parent 5ff6988e0d
commit fbe8708718
5 changed files with 43 additions and 8 deletions

View file

@ -70,6 +70,16 @@ describe("Login", () => {
downloadSpeedLimit: 3,
},
captchaID: "",
preferences: {
bg: {
url: "bgUrl",
repeat: "bgRepeat",
position: "bgPosition",
align: "bgAlign",
},
cssURL: "cssURL",
lanPackURL: "lanPackURL",
},
});
// panes

View file

@ -82,6 +82,16 @@ describe("State Manager", () => {
},
authed: true,
captchaID: "",
preferences: {
bg: {
url: "bgUrl",
repeat: "bgRepeat",
position: "bgPosition",
align: "bgAlign",
},
cssURL: "cssURL",
lanPackURL: "lanPackURL",
},
});
// admin
@ -177,6 +187,16 @@ describe("State Manager", () => {
usedSpace: mockSelfResp.data.usedSpace,
authed: false,
captchaID: "",
preferences: {
bg: {
url: "bgUrl",
repeat: "bgRepeat",
position: "bgPosition",
align: "bgAlign",
},
cssURL: "cssURL",
lanPackURL: "lanPackURL",
},
});
// admin

View file

@ -24,8 +24,6 @@ export interface UIProps {
position: string;
align: string;
};
cssURL: string;
lanPackURL: string;
}
export interface ICoreState {
browser: BrowserProps;
@ -70,6 +68,16 @@ export function initState(): ICoreState {
},
authed: false,
captchaID: "",
preferences: {
bg: {
url: "",
repeat: "",
position: "",
align: "",
},
cssURL: "",
lanPackURL: "",
}
},
admin: {
users: Map<string, User>(),
@ -89,8 +97,6 @@ export function initState(): ICoreState {
position: "",
align: "",
},
cssURL: "",
lanPackURL: "",
},
};
}

View file

@ -5,7 +5,7 @@ import { ICoreState, MsgProps } from "./core_state";
import { Flexbox } from "./layout/flexbox";
import { updater } from "./state_updater";
import { alertMsg } from "../common/env";
import { Quota } from "../client";
import { Quota, Preferences } from "../client";
export interface LoginProps {
userID: string;
@ -15,6 +15,7 @@ export interface LoginProps {
quota: Quota;
authed: boolean;
captchaID: string;
preferences: Preferences;
}
export interface Props {

View file

@ -387,9 +387,7 @@ export class Updater {
this.props.login.userRole = resp.data.role;
this.props.login.usedSpace = resp.data.usedSpace;
this.props.login.quota = resp.data.quota;
this.props.ui.bg = resp.data.preferences.bg;
this.props.ui.cssURL = resp.data.preferences.cssURL;
this.props.ui.lanPackURL = resp.data.preferences.lanPackURL;
this.props.login.preferences = resp.data.preferences;
return true;
}
this.resetUser();