Skip to content

feat(site): Read users into basic UsersTable #981

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test
  • Loading branch information
presleyp committed Apr 12, 2022
commit 3fce4f025dbe2afe2c858791cb545c83376735ff
17 changes: 17 additions & 0 deletions site/src/pages/UsersPage/UsersPage.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { screen } from "@testing-library/react"
import React from "react"
import { render } from "../../test_helpers"
import { UsersPage } from "./UsersPage"

describe("Users Page", () => {
it("has a header with the total number of users", async () => {
render(<UsersPage />)
const total = await screen.findByText(/\d+ total/)
expect(total.innerHTML).toEqual("2 total")
})
it("shows users", async () => {
render(<UsersPage />)
const users = await screen.findAllByText(/.*@coder.com/)
expect(users.length).toEqual(2)
})
})
6 changes: 3 additions & 3 deletions site/src/test_helpers/entities.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { v4 as uuidv4 } from "uuid"
import {
BuildInfoResponse,
Organization,
Pager,
Provisioner,
Template,
UserAgent,
UserResponse,
Workspace,
Pager
} from "../api/types"
import { v4 as uuidv4 } from 'uuid';

export const MockSessionToken = { session_token: "my-session-token" }

Expand Down Expand Up @@ -37,7 +37,7 @@ export const MockPager: Pager = {
after: uuidv4(),
before: uuidv4(),
limit: 10,
total: 25
total: 2,
}

export const MockOrganization: Organization = {
Expand Down