claude overtook and fixes

This commit is contained in:
JiriUhlir
2026-06-29 10:17:14 +02:00
parent 5281d56998
commit 04fbf692a3
6 changed files with 151 additions and 6 deletions
+27 -1
View File
@@ -42,6 +42,29 @@ describe("SessionManager", () => {
expect(sessionManager.buildCookieHeader(session)).toBe("B1SESSION=abc123; ROUTEID=.node1");
});
it("sends the language as an integer code to the Login action", async () => {
const http = {
post: vi.fn().mockResolvedValue({
data: { SessionId: "abc123", SessionTimeout: 30 },
headers: {}
})
};
const sessionManager = new SessionManager(http as never, { ...config, language: "3" });
await sessionManager.getSession();
expect(http.post).toHaveBeenCalledWith(
"/Login",
{
CompanyDB: "SBODEMOUS",
UserName: "manager",
Password: "secret",
Language: 3
},
{ skipAuth: true }
);
});
it("logs out and clears the current session", async () => {
const http = {
post: vi
@@ -57,7 +80,10 @@ describe("SessionManager", () => {
await sessionManager.getSession();
await sessionManager.logout();
expect(http.post).toHaveBeenLastCalledWith("/Logout", undefined, { skipAuth: false });
expect(http.post).toHaveBeenLastCalledWith("/Logout", undefined, {
skipAuth: true,
headers: { Cookie: "B1SESSION=abc123" }
});
expect(sessionManager.currentSession).toBeUndefined();
});
});