@pwngh/economy-lab
    Preparing search index...

    Function fixedClock

    • Fake clock for tests. Frozen at start (epoch ms); only advance(ms) moves it forward, returning the new time. Keeps test outcomes repeatable.

      Parameters

      • start: number = 0

      Returns Clock & { advance: (ms: number) => number }

      const clock = fixedClock(Date.UTC(2026, 6, 1));
      // ...subscribe against an economy wired with this clock...
      clock.advance(31 * 24 * 60 * 60 * 1000); // a month passes; the renewal is due
      await worker.sweep(); // the sweep reads the advanced time