claude overtook and fixes
This commit is contained in:
+27
-1
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user