fix(fe): fix utest issues
This commit is contained in:
parent
5ff6988e0d
commit
fbe8708718
5 changed files with 43 additions and 8 deletions
|
@ -70,6 +70,16 @@ describe("Login", () => {
|
||||||
downloadSpeedLimit: 3,
|
downloadSpeedLimit: 3,
|
||||||
},
|
},
|
||||||
captchaID: "",
|
captchaID: "",
|
||||||
|
preferences: {
|
||||||
|
bg: {
|
||||||
|
url: "bgUrl",
|
||||||
|
repeat: "bgRepeat",
|
||||||
|
position: "bgPosition",
|
||||||
|
align: "bgAlign",
|
||||||
|
},
|
||||||
|
cssURL: "cssURL",
|
||||||
|
lanPackURL: "lanPackURL",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// panes
|
// panes
|
||||||
|
|
|
@ -82,6 +82,16 @@ describe("State Manager", () => {
|
||||||
},
|
},
|
||||||
authed: true,
|
authed: true,
|
||||||
captchaID: "",
|
captchaID: "",
|
||||||
|
preferences: {
|
||||||
|
bg: {
|
||||||
|
url: "bgUrl",
|
||||||
|
repeat: "bgRepeat",
|
||||||
|
position: "bgPosition",
|
||||||
|
align: "bgAlign",
|
||||||
|
},
|
||||||
|
cssURL: "cssURL",
|
||||||
|
lanPackURL: "lanPackURL",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// admin
|
// admin
|
||||||
|
@ -177,6 +187,16 @@ describe("State Manager", () => {
|
||||||
usedSpace: mockSelfResp.data.usedSpace,
|
usedSpace: mockSelfResp.data.usedSpace,
|
||||||
authed: false,
|
authed: false,
|
||||||
captchaID: "",
|
captchaID: "",
|
||||||
|
preferences: {
|
||||||
|
bg: {
|
||||||
|
url: "bgUrl",
|
||||||
|
repeat: "bgRepeat",
|
||||||
|
position: "bgPosition",
|
||||||
|
align: "bgAlign",
|
||||||
|
},
|
||||||
|
cssURL: "cssURL",
|
||||||
|
lanPackURL: "lanPackURL",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// admin
|
// admin
|
||||||
|
|
|
@ -24,8 +24,6 @@ export interface UIProps {
|
||||||
position: string;
|
position: string;
|
||||||
align: string;
|
align: string;
|
||||||
};
|
};
|
||||||
cssURL: string;
|
|
||||||
lanPackURL: string;
|
|
||||||
}
|
}
|
||||||
export interface ICoreState {
|
export interface ICoreState {
|
||||||
browser: BrowserProps;
|
browser: BrowserProps;
|
||||||
|
@ -70,6 +68,16 @@ export function initState(): ICoreState {
|
||||||
},
|
},
|
||||||
authed: false,
|
authed: false,
|
||||||
captchaID: "",
|
captchaID: "",
|
||||||
|
preferences: {
|
||||||
|
bg: {
|
||||||
|
url: "",
|
||||||
|
repeat: "",
|
||||||
|
position: "",
|
||||||
|
align: "",
|
||||||
|
},
|
||||||
|
cssURL: "",
|
||||||
|
lanPackURL: "",
|
||||||
|
}
|
||||||
},
|
},
|
||||||
admin: {
|
admin: {
|
||||||
users: Map<string, User>(),
|
users: Map<string, User>(),
|
||||||
|
@ -89,8 +97,6 @@ export function initState(): ICoreState {
|
||||||
position: "",
|
position: "",
|
||||||
align: "",
|
align: "",
|
||||||
},
|
},
|
||||||
cssURL: "",
|
|
||||||
lanPackURL: "",
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { ICoreState, MsgProps } from "./core_state";
|
||||||
import { Flexbox } from "./layout/flexbox";
|
import { Flexbox } from "./layout/flexbox";
|
||||||
import { updater } from "./state_updater";
|
import { updater } from "./state_updater";
|
||||||
import { alertMsg } from "../common/env";
|
import { alertMsg } from "../common/env";
|
||||||
import { Quota } from "../client";
|
import { Quota, Preferences } from "../client";
|
||||||
|
|
||||||
export interface LoginProps {
|
export interface LoginProps {
|
||||||
userID: string;
|
userID: string;
|
||||||
|
@ -15,6 +15,7 @@ export interface LoginProps {
|
||||||
quota: Quota;
|
quota: Quota;
|
||||||
authed: boolean;
|
authed: boolean;
|
||||||
captchaID: string;
|
captchaID: string;
|
||||||
|
preferences: Preferences;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
|
|
|
@ -387,9 +387,7 @@ export class Updater {
|
||||||
this.props.login.userRole = resp.data.role;
|
this.props.login.userRole = resp.data.role;
|
||||||
this.props.login.usedSpace = resp.data.usedSpace;
|
this.props.login.usedSpace = resp.data.usedSpace;
|
||||||
this.props.login.quota = resp.data.quota;
|
this.props.login.quota = resp.data.quota;
|
||||||
this.props.ui.bg = resp.data.preferences.bg;
|
this.props.login.preferences = resp.data.preferences;
|
||||||
this.props.ui.cssURL = resp.data.preferences.cssURL;
|
|
||||||
this.props.ui.lanPackURL = resp.data.preferences.lanPackURL;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
this.resetUser();
|
this.resetUser();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue