Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ export class FaturaClient {
constructor(env: EnvironmentKey = "PROD") {
this.baseURL = ENV[env].BASE_URL;
this.loginCmd = env === "PROD" ? "anologin" : "login";
this.logoutCmd = env === "PROD" ? "anologin" : "logout";
// "Güvenli Çıkış" (safe logout) uses the same command in both environments.
this.logoutCmd = "logout";
}

// ─── Core HTTP ─────────────────────────────────────────────────────────────
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/client.auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ describe("FaturaClient — auth", () => {
expect(getFetchCall().url).toBe(`${ENV.PROD.BASE_URL}/earsiv-services/assos-login`);
});

it("PROD: sends assoscmd=anologin (same as login)", async () => {
it("PROD: sends assoscmd=logout", async () => {
mockFetchOnce({ data: "url" });
await prodClient.logout("tok");
expect(getFetchCall().assoscmd).toBe("anologin");
expect(getFetchCall().assoscmd).toBe("logout");
});

it("TEST: sends assoscmd=logout", async () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/environment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ describe("FaturaClient — environment & constructor", () => {
expect(client.loginCmd).toBe("login");
});

it("sets PROD logoutCmd to 'anologin'", () => {
it("sets PROD logoutCmd to 'logout'", () => {
const client = new FaturaClient("PROD");
// @ts-expect-error private FaturaClient field for tests
expect(client.logoutCmd).toBe("anologin");
expect(client.logoutCmd).toBe("logout");
});

it("sets TEST logoutCmd to 'logout'", () => {
Expand Down