import type { Page } from "@playwright/test";

import { apiEnvelope } from "../data/common";
import { e2eEmailUser } from "../data/auth";
import { userEntitlementsResponse } from "../data/user";

export async function registerUserMocks(page: Page) {
  await page.route("**/api/user/profile", async (route) => {
    await route.fulfill({ json: apiEnvelope(e2eEmailUser) });
  });
  await page.route("**/api/user/entitlements", async (route) => {
    await route.fulfill({ json: apiEnvelope(userEntitlementsResponse) });
  });
}
