-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
238 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ tsconfig.tsbuildinfo | |
*.test.* | ||
*.spec.* | ||
vitest.config.ts | ||
setupTests.ts | ||
setupTests.ts | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import { createRef } from 'react'; | ||
import { Avatar, AvatarFallback } from './avatar'; | ||
|
||
describe('Avatar', () => { | ||
test('renders without crashing', () => { | ||
render(<Avatar />); | ||
const avatarElement = screen.getByTestId('avatar'); | ||
expect(avatarElement).toBeInTheDocument(); | ||
}); | ||
|
||
test('forwards ref correctly', () => { | ||
const ref = createRef<HTMLSpanElement>(); | ||
render(<Avatar ref={ref} />); | ||
expect(ref.current).not.toBeNull(); | ||
}); | ||
}); | ||
|
||
describe('AvatarFallback', () => { | ||
test('renders without crashing', () => { | ||
render(<Avatar><AvatarFallback /></Avatar>); | ||
const avatarFallbackElement = screen.getByTestId('avatar-fallback'); | ||
expect(avatarFallbackElement).toBeInTheDocument(); | ||
}); | ||
|
||
test('forwards ref correctly', () => { | ||
const ref = createRef<HTMLSpanElement>(); | ||
render(<Avatar><AvatarFallback ref={ref} /></Avatar>); | ||
expect(ref.current).not.toBeNull(); | ||
}); | ||
|
||
test('displays the initials inside', () => { | ||
render(<Avatar><AvatarFallback>CC</AvatarFallback></Avatar>); | ||
const avatarFallbackText = screen.getByText('CC'); | ||
expect(avatarFallbackText).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import { Badge } from './badge'; | ||
|
||
describe('Badge', () => { | ||
test('renders without crashing', () => { | ||
render(<Badge />); | ||
const badgeElement = screen.getByTestId('badge'); | ||
expect(badgeElement).toBeInTheDocument(); | ||
}); | ||
|
||
test('applies correct classes based on variant prop', () => { | ||
render(<Badge variant="secondary" />); | ||
const badgeElement = screen.getByTestId('badge'); | ||
expect(badgeElement).toHaveClass('border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80'); | ||
}); | ||
|
||
test('forwards additional props to rendered div element', () => { | ||
render(<Badge data-testid="badge" />); | ||
const badgeElement = screen.getByTestId('badge'); | ||
expect(badgeElement).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import { Checkbox } from './checkbox'; | ||
import { createRef } from 'react'; | ||
|
||
describe('Checkbox', () => { | ||
test('renders without crashing', () => { | ||
render(<Checkbox />); | ||
const checkboxElement = screen.getByRole('checkbox'); | ||
expect(checkboxElement).toBeInTheDocument(); | ||
}); | ||
|
||
test('forwards ref correctly', () => { | ||
const ref = createRef<HTMLButtonElement>(); | ||
render(<Checkbox ref={ref} />); | ||
expect(ref.current).not.toBeNull(); | ||
}); | ||
|
||
test('applies correct class names', () => { | ||
render(<Checkbox className="test-class" />); | ||
const checkboxElement = screen.getByRole('checkbox'); | ||
expect(checkboxElement).toHaveClass('test-class'); | ||
}); | ||
|
||
test('renders CheckIcon when checked', () => { | ||
render(<Checkbox checked />); | ||
const checkIconElement = screen.getByTestId('check-icon'); | ||
expect(checkIconElement).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { RISC0_PRIVACY_POLICY_URL, RISC0_TERMS_OF_SERVICE_URL } from './constants'; | ||
|
||
describe('Constants', () => { | ||
it('should have correct RISC0_PRIVACY_POLICY_URL', () => { | ||
expect(typeof RISC0_PRIVACY_POLICY_URL).toBe('string'); | ||
expect(RISC0_PRIVACY_POLICY_URL).toBe('https://www.risczero.com/policy'); | ||
}); | ||
|
||
it('should have correct RISC0_TERMS_OF_SERVICE_URL', () => { | ||
expect(typeof RISC0_TERMS_OF_SERVICE_URL).toBe('string'); | ||
expect(RISC0_TERMS_OF_SERVICE_URL).toBe('https://www.risczero.com/terms-of-service'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import { Input } from './input'; | ||
import { createRef } from 'react'; | ||
|
||
describe('Input', () => { | ||
test('renders without crashing', () => { | ||
render(<Input />); | ||
const inputElement = screen.getByRole('textbox'); | ||
expect(inputElement).toBeInTheDocument(); | ||
}); | ||
|
||
test('forwards ref correctly', () => { | ||
const ref = createRef<HTMLInputElement>(); | ||
render(<Input ref={ref} />); | ||
expect(ref.current).not.toBeNull(); | ||
}); | ||
|
||
test('renders startIcon correctly', () => { | ||
const StartIcon = () => <div data-testid="start-icon"></div>; | ||
render(<Input startIcon={<StartIcon />} />); | ||
const startIconElement = screen.getByTestId('start-icon'); | ||
expect(startIconElement).toBeInTheDocument(); | ||
}); | ||
|
||
test('renders endIcon correctly', () => { | ||
const EndIcon = () => <div data-testid="end-icon"></div>; | ||
render(<Input endIcon={<EndIcon />} />); | ||
const endIconElement = screen.getByTestId('end-icon'); | ||
expect(endIconElement).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.