fix(fe/tests): fix test failures, use 403 instead of 401

This commit is contained in:
hexxa 2022-02-27 18:10:21 +08:00 committed by Hexxa
parent 3be9343e52
commit 68c4949f2e
2 changed files with 8 additions and 8 deletions

View file

@ -174,7 +174,7 @@ describe("State Manager", () => {
};
usersCl.isAuthed = jest
.fn()
.mockReturnValue(makePromise({ status: 401, statusText: "", data: {} }));
.mockReturnValue(makePromise({ status: 403, statusText: "", data: {} }));
usersCl.self = jest.fn().mockReturnValue(makePromise(mockSelfResp));
const coreState = newState();
@ -263,14 +263,14 @@ describe("State Manager", () => {
usersCl.isAuthed = jest.fn().mockReturnValue(
makePromise({
status: 401,
status: 403,
statusText: "",
data: { error: "unauthorized" },
})
);
usersCl.self = jest.fn().mockReturnValue(
makePromise({
status: 401,
status: 403,
statusText: "",
data: { error: "malformed token" },
})

View file

@ -29,19 +29,19 @@ describe("TopBar", () => {
const isSharingMockResp = { status: 404, statusText: "", data: {} };
const listSharingsMockResp = {
status: 401,
status: 403,
statusText: "",
data: {
sharingDirs: new Array<string>(),
},
};
const listUploadingsMockResp = {
status: 401,
status: 403,
statusText: "",
data: { uploadInfos: new Array<UploadInfo>() },
};
const listHomeMockResp = {
status: 401,
status: 403,
statusText: "",
data: { cwd: "", metadatas: new Array<MetadataResp>() },
};
@ -54,7 +54,7 @@ describe("TopBar", () => {
};
const selfMockResp = {
status: 401,
status: 403,
statusText: "",
data: {
id: visitorID,
@ -68,7 +68,7 @@ describe("TopBar", () => {
},
},
};
const isAuthedMockResp = { status: 401, statusText: "", data: {} };
const isAuthedMockResp = { status: 403, statusText: "", data: {} };
const mockUserResps = {
...usersResps,
selfMockResp,