vi.fn() now returns Mock<Procedure | Constructable> in vitest 4, which
isn't directly callable or assignable to typed function signatures. Fix
by narrowing the mock type where it's called directly, and casting at
the assignment site for global.fetch.