1import { describe, expect, it } from "@effect/vitest";
2
3import {
4 MOBILE_BACKGROUND_RECONNECT_AFTER_MS,
5 mobileApplicationActiveWakeup,
6} from "./app-state-wakeups";
7
8describe("mobileApplicationActiveWakeup", () => {
9 it("uses a fast probe after a short interruption", () => {
10 expect(mobileApplicationActiveWakeup(null, 20_000)).toBe("application-active-probe");
11 expect(
12 mobileApplicationActiveWakeup(20_000, 20_000 + MOBILE_BACKGROUND_RECONNECT_AFTER_MS - 1),
13 ).toBe("application-active-probe");
14 });
15
16 it("replaces the session after a meaningful background suspension", () => {
17 expect(
18 mobileApplicationActiveWakeup(20_000, 20_000 + MOBILE_BACKGROUND_RECONNECT_AFTER_MS),
19 ).toBe("application-active-reconnect");
20 });
21});