-
-
Notifications
You must be signed in to change notification settings - Fork 864
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] Events Page Violates The Figma Style Guide (#3280)
* ui fix * ui fix * code coverage disable statement removed * code coverage disable statement removed * code coverage disable statement remove * code coverage statement remove * fix * fix test * test fix * fix failing test
- Loading branch information
1 parent
2490b2e
commit 33e7cd1
Showing
9 changed files
with
253 additions
and
126 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
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
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,51 @@ | ||
import React from 'react'; | ||
import { describe, test, expect } from 'vitest'; | ||
import { render, screen } from '@testing-library/react'; | ||
import HolidayCard from './HolidayCard'; | ||
import styles from './../../style/app.module.css'; | ||
|
||
describe('HolidayCard Component', () => { | ||
test('renders without crashing', () => { | ||
render(<HolidayCard holidayName="Christmas" />); | ||
expect(screen.getByTestId('holiday-card')).toBeDefined(); | ||
}); | ||
|
||
test('displays the provided holiday name', () => { | ||
const testHolidayName = 'New Year'; | ||
render(<HolidayCard holidayName={testHolidayName} />); | ||
|
||
const cardElement = screen.getByTestId('holiday-card'); | ||
expect(cardElement.textContent).toBe(testHolidayName); | ||
}); | ||
|
||
test('applies the correct CSS class', () => { | ||
render(<HolidayCard holidayName="Easter" />); | ||
|
||
const cardElement = screen.getByTestId('holiday-card'); | ||
expect(cardElement.className).toBe(styles.holidayCard); | ||
}); | ||
|
||
test('handles empty holiday name', () => { | ||
render(<HolidayCard holidayName="" />); | ||
|
||
const cardElement = screen.getByTestId('holiday-card'); | ||
expect(cardElement.textContent).toBe(''); | ||
}); | ||
|
||
test('handles long holiday names', () => { | ||
const longHolidayName = 'International Talk Like a Pirate Day Celebration'; | ||
render(<HolidayCard holidayName={longHolidayName} />); | ||
|
||
const cardElement = screen.getByTestId('holiday-card'); | ||
expect(cardElement.textContent).toBe(longHolidayName); | ||
}); | ||
|
||
// TypeScript compile-time tests | ||
test('TypeScript props validation', () => { | ||
// @ts-expect-error - Testing TypeScript validation for missing required prop | ||
render(<HolidayCard />); | ||
|
||
// @ts-expect-error - Testing TypeScript validation for wrong prop type | ||
render(<HolidayCard holidayName={123} />); | ||
}); | ||
}); |
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
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.