import { describe, expect, inject, it } from "vitest";
import { createGraphQLClient, graphql } from "@/tests/utils/graphql-client";

const listUsers = graphql(`
  query ListUsers {
    users {
      edges {
        node {
          id
          name
          email
          status
        }
      }
    }
  }
`);

describe("user--view-own-profile", () => {
  const gql = createGraphQLClient(inject("url"), inject("token"));

  it("Navigate to the profile page; verify name, email, and assigned roles are displayed correctly", async () => {
    const res = await gql.query(listUsers, {}).toPromise();

    expect(res.data?.users.edges.length).toBeGreaterThan(0);
    const user = res.data?.users.edges[0].node;
    expect(user?.name).toBeDefined();
    expect(user?.email).toBeDefined();
  });
});
