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

View file

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