import { default as base } from "./anonymousTest";
import { TestKitchen } from "./TestKitchen";
import { TestUser } from "./TestUser";

const authenticatedTest = base.extend<{
  user: TestUser & { kitchen: TestKitchen };
}>({
  user: [
    async ({ page }, use) => {
      const user = await TestUser.create();
      const kitchen = await user.completeOnboarding();
      user.kitchen = kitchen;
      await use(user as TestUser & { kitchen: TestKitchen });
      await user.delete();
    },
    { auto: true },
  ],
});

export default authenticatedTest;
