generated from UoaWDCC/react-template
-
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.
Implemented tests for PastEvent and EventCard components
- Loading branch information
Showing
3 changed files
with
9,983 additions
and
13,652 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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { render, screen } from '@/test-utils'; | ||
import { PastEvent } from './PastEvent'; | ||
|
||
describe('Banner component', () => { | ||
const ExampleEvent : PastEvent = { | ||
events: [ | ||
{ | ||
eventName: 'Pool Night 1', | ||
eventDescription: 'Enjoy a night of pure pool goodness at the Orange Club. $9 entry. Our execs will be there feel free to come say hi!', | ||
imgUrl: '/event_example.svg' | ||
}, | ||
{ | ||
eventName: 'Pool Night 2', | ||
eventDescription: 'Enjoy a night of pure pool goodness at the Orange Club. $9 entry. Our execs will be there feel free to come say hi!', | ||
imgUrl: '/event_example.svg' | ||
}, | ||
{ | ||
eventName: 'Pool Night 3', | ||
eventDescription: 'Enjoy a night of pure pool goodness at the Orange Club. $9 entry. Our execs will be there feel free to come say hi!', | ||
imgUrl: '/event_example.svg' | ||
}, | ||
{ | ||
eventName: 'Pool Night 4', | ||
eventDescription: 'Enjoy a night of pure pool goodness at the Orange Club. $9 entry. Our execs will be there feel free to come say hi!', | ||
imgUrl: '/event_example.svg' | ||
}, | ||
{ | ||
eventName: 'Pool Night 5', | ||
eventDescription: 'Enjoy a night of pure pool goodness at the Orange Club. $9 entry. Our execs will be there feel free to come say hi!', | ||
imgUrl: '/event_example.svg' | ||
}, | ||
{ | ||
eventName: 'Pool Night 6', | ||
eventDescription: 'Enjoy a night of pure pool goodness at the Orange Club. $9 entry. Our execs will be there feel free to come say hi!', | ||
imgUrl: '/event_example.svg' | ||
}, | ||
|
||
] | ||
} | ||
it('renders correctly', () => { | ||
render( | ||
<PastEvent | ||
events = {ExampleEvent.events} | ||
/> | ||
); | ||
ExampleEvent.events.forEach(event => { | ||
expect(screen.getByText(event.eventName)).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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { render, screen } from '@/test-utils'; | ||
import { EventCard, Event } from './EventCard'; | ||
|
||
// Test short event name and description | ||
describe('Short Event Name and Description', () => { | ||
const placeholderEvent : Event = { | ||
eventName: 'PoolNight', | ||
eventDescription: 'Pool at Orange', | ||
imgUrl: '/event_example.svg' | ||
}; | ||
it('renders correctly', () => { | ||
render( | ||
<EventCard | ||
event={placeholderEvent} | ||
/> | ||
); | ||
expect(screen.getByText(placeholderEvent.eventName)).toBeInTheDocument(); | ||
expect(screen.getByText(placeholderEvent.eventDescription)).toBeInTheDocument(); | ||
expect(screen.getByAltText(placeholderEvent.eventName)).toBeInTheDocument(); | ||
}); | ||
}); | ||
|
||
|
||
// Test short event name and description | ||
describe('Long Event Name and Description', () => { | ||
const placeholderEvent : Event = { | ||
eventName: 'Pool Night on a Wednesday Night, MEMBERS ONLY!!! SUPER EXCLUSIVE, SUPER FUN, SUPER AWESOME', | ||
eventDescription: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', | ||
imgUrl: '/event_example.svg' | ||
}; | ||
it('renders correctly', () => { | ||
render( | ||
<EventCard | ||
event={placeholderEvent} | ||
/> | ||
); | ||
expect(screen.getByText(placeholderEvent.eventName)).toBeInTheDocument(); | ||
expect(screen.getByText(placeholderEvent.eventDescription)).toBeInTheDocument(); | ||
expect(screen.getByAltText(placeholderEvent.eventName)).toBeInTheDocument(); | ||
}); | ||
}); |
Oops, something went wrong.