// $app/state mock factory. The vi.hoisted state holder still has to
// live in each test file (vitest mock-hoisting transform requires
// it) but the getter shape is centralized here.
//
// Usage:
//   const pageState = vi.hoisted(() => ({
//     pageUrl: new URL('http://localhost/search?q=miles')
//   }));
//   vi.mock('$app/state', () => pageUrlModule(pageState));
//   afterEach(() => { pageState.pageUrl = new URL('http://localhost/search?q=miles'); });

export type PageUrlState = { pageUrl: URL };

export function pageUrlModule(state: PageUrlState) {
  return {
    page: {
      get url() {
        return state.pageUrl;
      }
    }
  };
}
