Add visitor phone lookup flow
This commit is contained in:
@@ -65,6 +65,23 @@ describe("mutating queue requests", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("public visitor lookup", () => {
|
||||
it("posts the phone number and normalizes returned ticket numbers", async () => {
|
||||
const fetchMock = vi.fn().mockResolvedValue(jsonResponse({
|
||||
tickets: [{ display_number: "00012", status: "WAITING" }],
|
||||
}));
|
||||
vi.stubGlobal("fetch", fetchMock);
|
||||
|
||||
const response = await api.publicStatusByPhone("13800138000");
|
||||
const [url, init] = fetchMock.mock.calls[0] as [string, RequestInit];
|
||||
|
||||
expect(url).toBe("/api/public/status/search");
|
||||
expect(init.method).toBe("POST");
|
||||
expect(JSON.parse(String(init.body))).toEqual({ phone: "13800138000" });
|
||||
expect(response.tickets[0].ticket_number).toBe("00012");
|
||||
});
|
||||
});
|
||||
|
||||
describe("isolated portal authentication", () => {
|
||||
it("uses different endpoints for staff and admin sessions", async () => {
|
||||
const fetchMock = vi.fn().mockResolvedValue(jsonResponse({ user: { id: "u1", role: "STAFF" }, projects: [] }));
|
||||
|
||||
Reference in New Issue
Block a user