Guptaarnav 2024 10 28 (#4341)
* accessing toast error correctly * wrapping try-catch around fs.stat on cli arg * implemented array push * changing arg execution order for sketch arc * addressing sketchFromKclValue error for Sketches in Uservals * addressing 'update to He inside a test not wrapped in act(...' error * yarn fmt fix * implemented polygon stdlib function * changing polygon inscribed arg description in docs * addressing cargo clippy warning * Add tangential arc unavailable reason tooltip * fixing tsc errors * preventing hidden dirs from showing up as projects and prohibits renaming projects as hidden * adding unit test for desktop listProjects * showing no completions when last typed word is a number * fmt * Make clippy happy * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest) * yarn tsc fix: added missing toast import in Home.tsx * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest) * regenerating markdown docs for incoming merge from main --------- Co-authored-by: arnav <arnav@agupta.org> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import { fireEvent, render, screen, waitFor } from '@testing-library/react'
|
||||
import UserSidebarMenu from './UserSidebarMenu'
|
||||
import {
|
||||
Route,
|
||||
@ -13,7 +13,7 @@ import { CommandBarProvider } from './CommandBar/CommandBarProvider'
|
||||
type User = Models['User_type']
|
||||
|
||||
describe('UserSidebarMenu tests', () => {
|
||||
test("Renders user's name and email if available", () => {
|
||||
test("Renders user's name and email if available", async () => {
|
||||
const userWellFormed: User = {
|
||||
id: '8675309',
|
||||
name: 'Test User',
|
||||
@ -39,13 +39,19 @@ describe('UserSidebarMenu tests', () => {
|
||||
|
||||
fireEvent.click(screen.getByTestId('user-sidebar-toggle'))
|
||||
|
||||
expect(screen.getByTestId('username')).toHaveTextContent(
|
||||
userWellFormed.name || ''
|
||||
)
|
||||
expect(screen.getByTestId('email')).toHaveTextContent(userWellFormed.email)
|
||||
await waitFor(() => {
|
||||
expect(screen.getByTestId('username')).toHaveTextContent(
|
||||
userWellFormed.name || ''
|
||||
)
|
||||
})
|
||||
await waitFor(() => {
|
||||
expect(screen.getByTestId('email')).toHaveTextContent(
|
||||
userWellFormed.email
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
test("Renders just the user's email if no name is available", () => {
|
||||
test("Renders just the user's email if no name is available", async () => {
|
||||
const userNoName: User = {
|
||||
id: '8675309',
|
||||
email: 'kittycad.sidebar.test@example.com',
|
||||
@ -71,10 +77,12 @@ describe('UserSidebarMenu tests', () => {
|
||||
|
||||
fireEvent.click(screen.getByTestId('user-sidebar-toggle'))
|
||||
|
||||
expect(screen.getByTestId('username')).toHaveTextContent(userNoName.email)
|
||||
await waitFor(() => {
|
||||
expect(screen.getByTestId('username')).toHaveTextContent(userNoName.email)
|
||||
})
|
||||
})
|
||||
|
||||
test('Renders a menu button if no user avatar is available', () => {
|
||||
test('Renders a menu button if no user avatar is available', async () => {
|
||||
const userNoAvatar: User = {
|
||||
id: '8675309',
|
||||
name: 'Test User',
|
||||
@ -98,9 +106,11 @@ describe('UserSidebarMenu tests', () => {
|
||||
</TestWrap>
|
||||
)
|
||||
|
||||
expect(screen.getByTestId('user-sidebar-toggle')).toHaveTextContent(
|
||||
'User menu'
|
||||
)
|
||||
await waitFor(() => {
|
||||
expect(screen.getByTestId('user-sidebar-toggle')).toHaveTextContent(
|
||||
'User menu'
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user