feat(pwa): tg verified-login api (tgSession/tgPoll) + schemas
This commit is contained in:
1 parent
b419a456fe
commit
bd1a4a31bd
2 files changed
+29
-1
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { BalanceSchema, TopupSchema, PaymentsSchema, AuthRequestSchema } from "./driver";
|
||||
import { BalanceSchema, TopupSchema, PaymentsSchema, AuthRequestSchema, TgSessionSchema, TgPollSchema } from "./driver";
|
||||
|
||||
describe("driver api schemas", () => {
|
||||
it("parses balance", () => {
|
||||
@@ -24,3 +24,16 @@ describe("driver api schemas", () => {
|
||||
expect(v.payments[0].status).toBe("PAID");
|
||||
});
|
||||
});
|
||||
|
||||
describe("tg verified-login schemas", () => {
|
||||
it("parses tg session", () => {
|
||||
const v = TgSessionSchema.parse({ pair_session: "S", deep_link: "https://t.me/x?start=S" });
|
||||
expect(v.pair_session).toBe("S");
|
||||
});
|
||||
it("parses tg poll states", () => {
|
||||
expect(TgPollSchema.parse({ status: "pending" }).status).toBe("pending");
|
||||
expect(TgPollSchema.parse({ status: "expired" }).status).toBe("expired");
|
||||
const a = TgPollSchema.parse({ status: "authenticated", token: "T", driver_id: 7 });
|
||||
expect(a.status === "authenticated" && a.token).toBe("T");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user