-
Notifications
You must be signed in to change notification settings - Fork 22
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
4 changed files
with
76 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { mountSuspended } from '@nuxt/test-utils/runtime' | ||
import LeaderboardInfo from './LeaderboardInfo.vue' | ||
import type { LeaderboardViewModel } from '~/lib/api/data-contracts' | ||
|
||
const game: LeaderboardViewModel = { | ||
id: 1, | ||
name: 'Getting Over It With Bennet Foddy', | ||
slug: 'slug-2', | ||
info: 'Something special', | ||
createdAt: '2024-11-02T22:11:08+0000', | ||
updatedAt: '2024-11-02T22:11:08+0000', | ||
deletedAt: null, | ||
categories: [], | ||
} | ||
|
||
describe('LeaderboardInfo Component', () => { | ||
it('should render without crashing', async () => { | ||
const wrapper = await mountSuspended(LeaderboardInfo, { | ||
props: { | ||
leaderboard: game, | ||
}, | ||
}) | ||
|
||
expect(wrapper.isVisible()).toBe(true) | ||
|
||
const header = wrapper.get('div#leaderboard-show-header h1') | ||
|
||
expect(header.text()).toContain(game.name) | ||
}) | ||
}) |
25 changes: 25 additions & 0 deletions
25
components/blocks/LeaderboardInfo/LeaderboardInfoAccordion.test.ts
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,25 @@ | ||
import { mountSuspended } from '@nuxt/test-utils/runtime' | ||
import LeaderboardInfoAccordion from './LeaderboardInfoAccordion.vue' | ||
|
||
const info = 'Some Special Info' | ||
|
||
describe('LeaderboardInfoAccordion Component', () => { | ||
it('should render without crashing', async () => { | ||
const wrapper = await mountSuspended(LeaderboardInfoAccordion, { | ||
props: { | ||
info: info, | ||
}, | ||
}) | ||
|
||
expect(wrapper.isVisible()).toBe(true) | ||
|
||
// click the info button to open the info pane | ||
const button = wrapper.get('button#leaderboard-info-button') | ||
button.trigger('click') | ||
await wrapper.vm.$nextTick() | ||
|
||
const infoText = wrapper.get('p#leaderboard-info-text') | ||
|
||
expect(infoText.text()).toContain(info) | ||
}) | ||
}) |
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