diff --git a/components/blocks/ResendConfirmationBar/ResendConfirmationBar.vue b/components/blocks/ResendConfirmationBar/ResendConfirmationBar.vue index beebe576..059ffe67 100644 --- a/components/blocks/ResendConfirmationBar/ResendConfirmationBar.vue +++ b/components/blocks/ResendConfirmationBar/ResendConfirmationBar.vue @@ -1,6 +1,8 @@ diff --git a/components/blocks/cards/ForgotPasswordCard/ForgotPasswordCard.test.ts b/components/blocks/cards/ForgotPasswordCard/ForgotPasswordCard.test.ts index 8bdad174..ec314379 100644 --- a/components/blocks/cards/ForgotPasswordCard/ForgotPasswordCard.test.ts +++ b/components/blocks/cards/ForgotPasswordCard/ForgotPasswordCard.test.ts @@ -2,18 +2,32 @@ import { mockNuxtImport, mountSuspended } from '@nuxt/test-utils/runtime' import { getByTestId } from 'root/testUtils' import ForgotPasswordCard from './ForgotPasswordCard.vue' import type { RecoverAccountRequest } from 'lib/api/data-contracts' +import type { optionalParameters } from '~/composables/useApi' -mockNuxtImport('useRecoverAccount', () => { - return async ( - _requestData: RecoverAccountRequest, - opts: optionalParameters = {}, - ) => { - const { onOkay } = opts - if (onOkay) { - await onOkay() +vi.mock( + import('~/composables/api/useRecoverAccount'), + async (importOriginal) => { + const mod = await importOriginal() + + return { + ...mod, + // replace some exports + onOkay: vi.fn(), } - } -}) + }, +) + +// mockNuxtImport('useRecoverAccount', () => { +// return async ( +// _requestData: RecoverAccountRequest, +// opts: optionalParameters = {}, +// ) => { +// const { onOkay } = opts +// if (onOkay) { +// await onOkay() +// } +// } +// }) afterAll(() => { vi.restoreAllMocks() diff --git a/components/blocks/cards/ForgotPasswordCard/ForgotPasswordCard.vue b/components/blocks/cards/ForgotPasswordCard/ForgotPasswordCard.vue index b4d07bd3..55377900 100644 --- a/components/blocks/cards/ForgotPasswordCard/ForgotPasswordCard.vue +++ b/components/blocks/cards/ForgotPasswordCard/ForgotPasswordCard.vue @@ -7,6 +7,8 @@ import CardBody from 'elements/cards/CardBody/CardBody.vue' import CardHeader from 'elements/cards/CardHeader/CardHeader.vue' import BaseInput from 'elements/inputs/BaseInput/BaseInput.vue' import { isEmailValid, isUsernameValid } from 'lib/form_helpers' +import { useModalAlert } from '#imports' +import { useRecoverAccount } from '~/composables/api' interface ForgotPasswordCardPops { modal?: boolean @@ -21,7 +23,7 @@ const emit = defineEmits<{ (event: 'close' | 'cancelClick'): void }>() -const props = withDefaults(defineProps(), { +withDefaults(defineProps(), { modal: false, }) @@ -76,7 +78,7 @@ function resetPassword() {
Forgot Password
diff --git a/components/blocks/cards/LogInCard/LogInCard.vue b/components/blocks/cards/LogInCard/LogInCard.vue index 3878bebc..e50ab261 100644 --- a/components/blocks/cards/LogInCard/LogInCard.vue +++ b/components/blocks/cards/LogInCard/LogInCard.vue @@ -8,6 +8,7 @@ import CardBody from 'elements/cards/CardBody/CardBody.vue' import CardHeader from 'elements/cards/CardHeader/CardHeader.vue' import Card from 'elements/cards/Card/Card.vue' import HideShowPassword from 'elements/buttons/HideShowPassword/HideShowPassword.vue' +import { useLoginUser } from '~/composables/api' interface LogInCardProps { modal?: boolean @@ -23,7 +24,7 @@ const emit = defineEmits<{ (event: 'close' | 'forgotPasswordClick' | 'signUpClick'): void }>() -const props = withDefaults(defineProps(), { +withDefaults(defineProps(), { modal: false, }) @@ -72,7 +73,7 @@ async function login() { diff --git a/components/blocks/cards/SignUpCard/SignUpCard.test.ts b/components/blocks/cards/SignUpCard/SignUpCard.test.ts index 5eee1b79..1333952c 100644 --- a/components/blocks/cards/SignUpCard/SignUpCard.test.ts +++ b/components/blocks/cards/SignUpCard/SignUpCard.test.ts @@ -1,6 +1,7 @@ import { mountSuspended } from '@nuxt/test-utils/runtime' import { getByTestId, getHTMLElement } from 'root/testUtils' import SignUpCard from './SignUpCard.vue' +import { useRuntimeConfig } from '#imports' afterEach(() => { fetchMock.resetMocks() diff --git a/components/blocks/cards/SignUpCard/SignUpCard.vue b/components/blocks/cards/SignUpCard/SignUpCard.vue index 1badfbf8..5b2b0649 100644 --- a/components/blocks/cards/SignUpCard/SignUpCard.vue +++ b/components/blocks/cards/SignUpCard/SignUpCard.vue @@ -15,6 +15,7 @@ import CloseButton from 'elements/buttons/CloseButton/CloseButton.vue' import Card from 'elements/cards/Card/Card.vue' import CardHeader from 'elements/cards/CardHeader/CardHeader.vue' import CardBody from 'elements/cards/CardBody/CardBody.vue' +import { useLoginUser, useRegisterUser } from '~/composables/api' interface SignUpCardProps { modal?: boolean @@ -31,7 +32,7 @@ const emit = defineEmits<{ (event: 'close' | 'logInClick' | 'signUpClick'): void }>() -const props = withDefaults(defineProps(), { +withDefaults(defineProps(), { modal: false, }) @@ -124,7 +125,7 @@ function validatePasswordInputs() { diff --git a/components/blocks/nav/SiteNavbar/SiteNavbar.test.ts b/components/blocks/nav/SiteNavbar/SiteNavbar.test.ts index 9ade2086..c468539a 100644 --- a/components/blocks/nav/SiteNavbar/SiteNavbar.test.ts +++ b/components/blocks/nav/SiteNavbar/SiteNavbar.test.ts @@ -2,6 +2,7 @@ import { mountSuspended } from '@nuxt/test-utils/runtime' import * as apiComposables from 'composables/api' import { getByTestId } from 'root/testUtils' import SiteNavbar from './SiteNavbar.vue' +import { useSessionToken } from '#imports' afterEach(() => { vi.restoreAllMocks() diff --git a/components/blocks/nav/SiteNavbar/SiteNavbar.vue b/components/blocks/nav/SiteNavbar/SiteNavbar.vue index 99f63503..4d0fd643 100644 --- a/components/blocks/nav/SiteNavbar/SiteNavbar.vue +++ b/components/blocks/nav/SiteNavbar/SiteNavbar.vue @@ -9,6 +9,8 @@ import LogInCard from 'blocks/cards/LogInCard/LogInCard.vue' import SignUpCard from 'blocks/cards/SignUpCard/SignUpCard.vue' import BaseModal from 'elements/modals/BaseModal/BaseModal.vue' import SearchBar from 'blocks/SearchBar/SearchBar.vue' +import { useSessionToken } from '#imports' +import { useLogoutUser } from '~/composables/api' interface NavbarState { mobileNavIsActive: boolean diff --git a/components/elements/buttons/Dropdown/Dropdown.vue b/components/elements/buttons/Dropdown/Dropdown.vue index 991f9a3b..84522298 100644 --- a/components/elements/buttons/Dropdown/Dropdown.vue +++ b/components/elements/buttons/Dropdown/Dropdown.vue @@ -1,5 +1,5 @@