Skip to content

Commit

Permalink
readded globals for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
buffet-time committed Aug 16, 2024
1 parent 7a0c47a commit 910dd69
Show file tree
Hide file tree
Showing 41 changed files with 4 additions and 75 deletions.
2 changes: 0 additions & 2 deletions components/blocks/LeaderboardInfo/Desktop/Desktop.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { afterEach, describe, expect, it, vi } from 'vitest'

import { mountSuspended } from '@nuxt/test-utils/runtime'
import { getByTestId } from 'root/testUtils'
import Desktop from './Desktop.vue'
Expand Down
2 changes: 0 additions & 2 deletions components/blocks/LeaderboardInfo/LeaderboardInfo.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { afterEach, describe, expect, it, vi } from 'vitest'

import { mountSuspended } from '@nuxt/test-utils/runtime'
import { getByTestId } from 'root/testUtils'
import LeaderboardInfo from './LeaderboardInfo.vue'
Expand Down
2 changes: 0 additions & 2 deletions components/blocks/LeaderboardInfo/Mobile/Mobile.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { afterEach, describe, expect, it, vi } from 'vitest'

import { mountSuspended } from '@nuxt/test-utils/runtime'
import { getByTestId } from 'root/testUtils'
import Mobile from './Mobile.vue'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { describe, expect, it } from 'vitest'

import { mountSuspended } from '@nuxt/test-utils/runtime'
import PlatformTags from './PlatformTags.vue'

Expand Down
2 changes: 0 additions & 2 deletions components/blocks/ProfileHeader/ProfileHeader.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { describe, expect, it } from 'vitest'

import { mountSuspended } from '@nuxt/test-utils/runtime'
import ProfileHeader from './ProfileHeader.vue'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { describe, expect, it } from 'vitest'

import { mountSuspended } from '@nuxt/test-utils/runtime'
import UserActivity from './UserActivity.vue'

Expand Down
2 changes: 0 additions & 2 deletions components/blocks/ProfileHeader/UserBadges/UserBadges.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { describe, expect, it } from 'vitest'

import { mountSuspended } from '@nuxt/test-utils/runtime'
import UserBadges from './UserBadges.vue'

Expand Down
2 changes: 0 additions & 2 deletions components/blocks/SearchBar/SearchBar.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { describe, expect, it } from 'vitest'

/* eslint-disable @typescript-eslint/ban-ts-comment */
import { mountSuspended } from '@nuxt/test-utils/runtime'
import SearchBar from './SearchBar.vue'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { describe, expect, it } from 'vitest'

import { mountSuspended } from '@nuxt/test-utils/runtime'
import { supportedLocales } from 'root/configUtils'
import LanguageSelector from './LanguageSelector.vue'
Expand Down
2 changes: 0 additions & 2 deletions components/blocks/SiteFooter/SiteFooter.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { describe, expect, it } from 'vitest'

import { mountSuspended } from '@nuxt/test-utils/runtime'
import SiteFooter from './SiteFooter.vue'

Expand Down
4 changes: 1 addition & 3 deletions components/blocks/cards/BasicAlert/BasicAlert.test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'

import { mountSuspended } from '@nuxt/test-utils/runtime'
import { getByClass, getByTestId, getHTMLElement } from 'root/testUtils'
import BasicAlert from './BasicAlert.vue'

beforeEach(() => {
const { state: modalAlertState } = useModalAlert()
modalAlertState.value = {
title: 'A test alert?',
body: 'This is a test',
show: true,
title: 'A test alert?',
type: 'info',
}
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { afterAll, describe, expect, it, vi } from 'vitest'
import { mockNuxtImport, mountSuspended } from '@nuxt/test-utils/runtime'
import { getByTestId } from 'root/testUtils'
import ForgotPasswordCard from './ForgotPasswordCard.vue'
Expand Down
2 changes: 0 additions & 2 deletions components/blocks/cards/LogInCard/LogInCard.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'

import { mountSuspended } from '@nuxt/test-utils/runtime'
import { getByTestId, getHTMLElement } from 'root/testUtils'
import LogInCard from './LogInCard.vue'
Expand Down
2 changes: 0 additions & 2 deletions components/blocks/cards/SignUpCard/SignUpCard.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { afterEach, describe, expect, it, vi } from 'vitest'

import { mountSuspended } from '@nuxt/test-utils/runtime'
import { getByTestId, getHTMLElement } from 'root/testUtils'
import SignUpCard from './SignUpCard.vue'
Expand Down
2 changes: 0 additions & 2 deletions components/blocks/nav/SiteNavbar/SiteNavbar.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'

import { mountSuspended } from '@nuxt/test-utils/runtime'
import * as apiComposables from 'composables/api'
import { getByTestId } from 'root/testUtils'
Expand Down
2 changes: 0 additions & 2 deletions components/elements/buttons/ButtonLink/ButtonLink.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { describe, expect, it } from 'vitest'

import { mountSuspended } from '@nuxt/test-utils/runtime'
import ButtonLink from './ButtonLink.vue'

Expand Down
2 changes: 0 additions & 2 deletions components/elements/buttons/Dropdown/Dropdown.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { describe, expect, it } from 'vitest'

import { mountSuspended } from '@nuxt/test-utils/runtime'
import { getByTestId } from 'root/testUtils'
import Dropdown from './Dropdown.vue'
Expand Down
2 changes: 0 additions & 2 deletions components/elements/buttons/Dropdown/DropdownItem.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { describe, expect, it } from 'vitest'

import { mountSuspended } from '@nuxt/test-utils/runtime'
import { getByTestId } from 'root/testUtils'
import DropdownItem from './DropdownItem.vue'
Expand Down
2 changes: 0 additions & 2 deletions components/elements/buttons/FollowButton/FollowButton.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { describe, expect, it } from 'vitest'

import { mountSuspended } from '@nuxt/test-utils/runtime'
import FollowButton from './FollowButton.vue'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { describe, expect, it } from 'vitest'

import { mountSuspended } from '@nuxt/test-utils/runtime'
import { getByTestId, getHTMLElement } from 'root/testUtils'
import HideShowPassword from './HideShowPassword.vue'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { describe, expect, it } from 'vitest'

import { mountSuspended } from '@nuxt/test-utils/runtime'
import SocialButtons from './SocialButtons.vue'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { afterEach, describe, expect, it, vi } from 'vitest'

import { mountSuspended } from '@nuxt/test-utils/runtime'
import { getHTMLElement } from 'root/testUtils'
import PasswordInput from './PasswordInput.vue'
Expand Down
2 changes: 0 additions & 2 deletions components/elements/modals/BaseModal/BaseModal.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { afterEach, describe, expect, it } from 'vitest'

import { mount, enableAutoUnmount } from '@vue/test-utils'

import BaseModal from './BaseModal.vue'
Expand Down
2 changes: 0 additions & 2 deletions components/elements/nav/NavLinks/NavLink/NavLink.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { describe, expect, it } from 'vitest'

import { mountSuspended } from '@nuxt/test-utils/runtime'
import NavLink from './NavLink.vue'

Expand Down
1 change: 0 additions & 1 deletion components/elements/nav/NavLinks/NavLinks.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { afterEach, describe, expect, it } from 'vitest'
import { mount, enableAutoUnmount } from '@vue/test-utils'

import NavLinks from './NavLinks.vue'
Expand Down
2 changes: 0 additions & 2 deletions composables/api/useChangePassword/useChangePassword.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { describe, expect, it, vi } from 'vitest'

const mockSuccessRecoverCreate2 = vi.fn(() => Promise.resolve({ ok: true }))

describe('useChangePassword', () => {
Expand Down
2 changes: 0 additions & 2 deletions composables/api/useConfirmAccount/useConfirmAccount.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { describe, expect, it, vi } from 'vitest'

const mockSuccessAccountConfirmation = vi.fn(() =>
Promise.resolve({ ok: true }),
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { describe, expect, it, vi } from 'vitest'

const mockSuccessLeaderboardsDetail = vi.fn(() => Promise.resolve({ ok: true }))

describe('useGetLeaderboardDetail', () => {
Expand Down
2 changes: 0 additions & 2 deletions composables/api/useGetUserDetail/useGetUserDetail.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { describe, expect, it, vi } from 'vitest'

const mockSuccessUsersDetail = vi.fn(() => Promise.resolve({ ok: true }))

describe('useGetUserDetail', () => {
Expand Down
1 change: 0 additions & 1 deletion composables/api/useLoginUser/useLoginUser.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { afterEach, describe, expect, it, vi } from 'vitest'
// const mockFailureUsersLoginCreate = vi.fn(() => Promise.resolve({ ok: false }))
const mockSuccessAccountLoginCreate = vi.fn(() =>
Promise.resolve({ data: { token: 'token' }, ok: true }),
Expand Down
1 change: 0 additions & 1 deletion composables/api/useLogoutUser/useLogoutUser.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import type { UserViewModel } from 'lib/api/data-contracts'

const token = 'auth-token'
Expand Down
2 changes: 0 additions & 2 deletions composables/api/useRecoverAccount/useRecoverAccount.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { describe, expect, it, vi } from 'vitest'

const mockSuccessRecoverCreate = vi.fn(() => Promise.resolve({ ok: true }))

describe('useRecoverAccount', () => {
Expand Down
2 changes: 0 additions & 2 deletions composables/api/useRegisterUser/useRegisterUser.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { describe, expect, it, vi } from 'vitest'

const mockSuccessRegisterCreate = vi.fn(() => Promise.resolve({ ok: true }))

describe('useRegisterUser', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { afterEach, describe, expect, it, vi } from 'vitest'

const mockSuccessLogin = vi.fn(() =>
Promise.resolve({ data: { token: 'token' }, ok: true }),
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { describe, expect, it, vi } from 'vitest'

const mockSuccessRecoverDetail = vi.fn(() => Promise.resolve({ ok: true }))

describe('useValidateRecoveryToken', () => {
Expand Down
1 change: 0 additions & 1 deletion composables/useApi/useApi.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { describe, expect, it, vi } from 'vitest'
import { ref } from 'vue'
import type { ProblemDetails } from 'lib/api/data-contracts'
import type { HttpResponse } from 'lib/api/http-client'
Expand Down
2 changes: 0 additions & 2 deletions pages/confirm-account.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { vi, describe, it, expect } from 'vitest'

import { mountSuspended } from '@nuxt/test-utils/runtime'
import { getByClass } from 'root/testUtils'
import confirmAccount from 'pages/confirm-account.vue'
Expand Down
2 changes: 0 additions & 2 deletions pages/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { describe, it, expect } from 'vitest'

import { mountSuspended } from '@nuxt/test-utils/runtime'
import index from 'pages/index.vue'

Expand Down
2 changes: 0 additions & 2 deletions pages/reset-password.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { vi, describe, it, expect } from 'vitest'

import { mountSuspended } from '@nuxt/test-utils/runtime'
import { getByClass } from 'root/testUtils'
import resetPassword from 'pages/reset-password.vue'
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

// Other
"jsx": "preserve",
"lib": ["ESNext", "DOM"]
"lib": ["ESNext", "DOM"],
"types": ["vitest/globals"]
},
// https://v3.nuxtjs.org/concepts/typescript
"extends": "./.nuxt/tsconfig.json"
Expand Down
1 change: 1 addition & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { defineVitestConfig } from '@nuxt/test-utils/config'
export default defineVitestConfig({
test: {
environment: 'nuxt',
globals: true,
sequence: {
shuffle: true,
},
Expand Down

0 comments on commit 910dd69

Please sign in to comment.