Skip to content

Commit

Permalink
fix: check error value statusCode is 404 when status code is 404
Browse files Browse the repository at this point in the history
  • Loading branch information
Eein committed Nov 14, 2024
1 parent c43f14d commit e69a7d5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pages/game/[slug].test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { mountSuspended } from '@nuxt/test-utils/runtime'
import useGetLeaderboardBySlug from '~/composables/api/useGetLeaderboardBySlug/index'
import gamePage from 'pages/game/[slug].vue'

import { useError } from '#imports'
import type { LeaderboardViewModel } from '~/lib/api/data-contracts'

const leaderboard: LeaderboardViewModel = {
Expand Down Expand Up @@ -45,7 +45,10 @@ describe('/game/:slug', () => {
const wrapper = await mountSuspended(gamePage, {
route: '/game/invalidslug',
})

const error = useError()

expect(error?.value?.statusCode).toBe(404)
expect(wrapper.text()).not.toContain(leaderboard.name)
// Ideally we'd check for the error
})
})

0 comments on commit e69a7d5

Please sign in to comment.