---
title: "nuxt-backend/test-utils"
description: "Every export of nuxt-backend/test-utils, with its signature and where it is defined."
canonical_url: "https://nuxt-backend.dev/docs/reference/api/test-utils"
---
# nuxt-backend/test-utils

Version: nuxt-backend 0.6.x · Tab: Reference · Kind: reference · Status: stable

Every page: [llms.txt](https://nuxt-backend.dev/llms.txt) · Skill for coding agents: [nuxt-backend](https://nuxt-backend.dev/.well-known/skills/nuxt-backend/SKILL.md)

Commands use npm; use your project's package manager.

**Experimental**

Test helpers for an app's Vue side — `nuxt-backend/test-utils`:
[createBackendMock](#createbackendmock), a fake backend and session that the package's
composables and components, and the base module's, read in a component or
page test; [resetBackendMock](#resetbackendmock), which forgets it;
[backendMockProvides](#backendmockprovides), what a plain `mount()` provides it with;
[backendTestAliases](#backendtestaliases), the Vitest aliases that point them at it, so a
test needs no `vi.mock`; and [renderEmail](#renderemail), which renders an email
the package sends as your `setupEmail` options would. Your Convex functions
are tested with `nuxt-backend/test` instead.

Experimental: the mock answers the way the auth and billing flows answer
today, and follows them as they move.

## Interfaces

### RenderEmailOptions

Defined in: [src/runtime/test-utils/email.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/email.ts)

**Experimental**

What [renderEmail](#renderemail) renders with: `setupEmail`'s rendering options, and the deployment's settings it would read.

#### Extends

- `EmailRenderOptions`

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Inherited from
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="templates">
        
      </a>
      
       <code>
        templates?
      </code>
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/email#emailtemplateoverrides">
        <code>
          EmailTemplateOverrides
        </code>
      </a>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       Overrides by template name; see <a href="https://nuxt-backend.dev/docs/reference/api/email#emailtemplateoverrides">
        EmailTemplateOverrides
      </a>
      
      .
    </td>
    
    <td>
      <code>
        EmailRenderOptions.templates
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/email-templates.ts" rel="nofollow">
        src/convex/email-templates.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="messages">
        
      </a>
      
       <code>
        messages?
      </code>
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/email#emailmessages">
        <code>
          EmailMessages
        </code>
      </a>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       The words in other languages; see <a href="https://nuxt-backend.dev/docs/reference/api/email#emailmessages">
        EmailMessages
      </a>
      
      .
    </td>
    
    <td>
      <code>
        EmailRenderOptions.messages
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/email-templates.ts" rel="nofollow">
        src/convex/email-templates.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="defaultlocale">
        
      </a>
      
       <code>
        defaultLocale?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       The language for a recipient whose own has no messages, and for one nobody knows. Default <code>
        'en'
      </code>
      
      .
    </td>
    
    <td>
      <code>
        EmailRenderOptions.defaultLocale
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/email-templates.ts" rel="nofollow">
        src/convex/email-templates.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="locales">
        
      </a>
      
       <code>
        locales?
      </code>
    </td>
    
    <td>
      readonly <code>
        string
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       The languages the app serves, as its <code>
        @nuxtjs/i18n
      </code>
      
       <code>
        locales
      </code>
      
       codes. An email is written, and its links prefixed, only in one of these or <code>
        defaultLocale
      </code>
      
      . Default: the languages <code>
        messages
      </code>
      
       carries; without <code>
        messages
      </code>
      
      , the package's own translations, unless <code>
        localePaths
      </code>
      
       prefixes the links.
    </td>
    
    <td>
      <code>
        EmailRenderOptions.locales
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/email-templates.ts" rel="nofollow">
        src/convex/email-templates.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="localepaths">
        
      </a>
      
       <code>
        localePaths?
      </code>
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/email#emaillocalepaths">
        <code>
          EmailLocalePaths
        </code>
      </a>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       Whether email links carry the language in their path; see <a href="https://nuxt-backend.dev/docs/reference/api/email#emaillocalepaths">
        EmailLocalePaths
      </a>
      
      .
    </td>
    
    <td>
      <code>
        EmailRenderOptions.localePaths
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/email-templates.ts" rel="nofollow">
        src/convex/email-templates.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="brand">
        
      </a>
      
       <code>
        brand?
      </code>
    </td>
    
    <td>
      { <code>
        name?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        logo?
      </code>
      
      : <code>
        string
      </code>
      
      ; }
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       The app's name and logo; see <a href="https://nuxt-backend.dev/docs/reference/api/email#emailbrand">
        EmailBrand
      </a>
      
      .
    </td>
    
    <td>
      <code>
        EmailRenderOptions.brand
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/email-templates.ts" rel="nofollow">
        src/convex/email-templates.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        brand.name?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/email-templates.ts" rel="nofollow">
        src/convex/email-templates.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        brand.logo?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/email-templates.ts" rel="nofollow">
        src/convex/email-templates.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="theme">
        
      </a>
      
       <code>
        theme?
      </code>
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/email#emailtheme">
        <code>
          EmailTheme
        </code>
      </a>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       The layout's colors in each scheme and its fonts; see <a href="https://nuxt-backend.dev/docs/reference/api/email#emailtheme">
        EmailTheme
      </a>
      
      . Every key is optional.
    </td>
    
    <td>
      <code>
        EmailRenderOptions.theme
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/email-templates.ts" rel="nofollow">
        src/convex/email-templates.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="labels">
        
      </a>
      
       <code>
        labels?
      </code>
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/email#applabels">
        <code>
          AppLabels
        </code>
      </a>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       The labels app config sets (<code>
        appConfig.backend.labels
      </code>
      
      ), as the module writes them to <code>
        labels.generated.ts
      </code>
      
      : read before <code>
        messages
      </code>
      
      , as the app's pages read them before its i18n messages, so an email or a notification says what the pages say. See <a href="https://nuxt-backend.dev/docs/reference/api/email#applabels">
        AppLabels
      </a>
      
      .
    </td>
    
    <td>
      <code>
        EmailRenderOptions.labels
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/email-templates.ts" rel="nofollow">
        src/convex/email-templates.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="locale">
        
      </a>
      
       <code>
        locale?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       The recipient's language, as <code>
        user.locale
      </code>
      
       holds it. Default: the default locale.
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/email.ts" rel="nofollow">
        src/runtime/test-utils/email.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="siteurl">
        
      </a>
      
       <code>
        siteUrl?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       The site the brand links to and the links point at, as <code>
        SITE_URL
      </code>
      
      . Default <code>
        https://app.example.com
      </code>
      
      .
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/email.ts" rel="nofollow">
        src/runtime/test-utils/email.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="from">
        
      </a>
      
       <code>
        from?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       The sender, as <code>
        EMAIL_FROM
      </code>
      
      : its display name names the brand when <code>
        brand.name
      </code>
      
       does not.
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/email.ts" rel="nofollow">
        src/runtime/test-utils/email.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### BackendMockUser

Defined in: [src/runtime/test-utils/mock.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts)

**Experimental**

The signed-in account: Better Auth's user fields, with the admin plugin's `role` and `banned`.

#### Indexable

```ts
[field: string]: unknown
```

**Experimental**

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="id">
        
      </a>
      
       <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       Default: <code>
        'user-1'
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="name">
        
      </a>
      
       <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       Default: <code>
        'Ada Lovelace'
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="email">
        
      </a>
      
       <code>
        email
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       Default: <code>
        'ada@example.com'
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="emailverified">
        
      </a>
      
       <code>
        emailVerified
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       Default: <code>
        true
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="image">
        
      </a>
      
       <code>
        image?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="role">
        
      </a>
      
       <code>
        role
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       The app-wide role (<code>
        'admin'
      </code>
      
      , or several comma-separated); <code>
        'user'
      </code>
      
       by default.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="banned">
        
      </a>
      
       <code>
        banned?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="lastloginmethod">
        
      </a>
      
       <code>
        lastLoginMethod?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       How the account last signed in (<code>
        'passkey'
      </code>
      
      , <code>
        'email-otp'
      </code>
      
      ); the built-in sign-in answers set it.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### BackendMockWorkspace

Defined in: [src/runtime/test-utils/mock.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts)

**Experimental**

A workspace the account belongs to, with its role there and, optionally, who else is in it.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="id-1">
        
      </a>
      
       <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="name-1">
        
      </a>
      
       <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="slug">
        
      </a>
      
       <code>
        slug
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="logo">
        
      </a>
      
       <code>
        logo?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="createdat">
        
      </a>
      
       <code>
        createdAt
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="role-1">
        
      </a>
      
       <code>
        role
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       The signed-in account's role here. Default: <code>
        'owner'
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="members">
        
      </a>
      
       <code>
        members?
      </code>
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-workspace#workspacemember">
        <code>
          WorkspaceMember
        </code>
      </a>
      
      <span>
        
      </span>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       Everyone in it. Default: the signed-in account alone, with <code>
        role
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="invitations">
        
      </a>
      
       <code>
        invitations?
      </code>
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-workspace#workspaceinvitation">
        <code>
          WorkspaceInvitation
        </code>
      </a>
      
      <span>
        
      </span>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       The invitations it has sent. Default: none.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### BackendMockInvitation

Defined in: [src/runtime/test-utils/mock.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts)

**Experimental**

An invitation sent to the account, with what the invitation page shows about it.

#### Extends

- [`ReceivedInvitation`](https://nuxt-backend.dev/docs/reference/api/use-workspace#receivedinvitation)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Inherited from
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="workspacename">
        
      </a>
      
       <code>
        workspaceName?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       Default: the workspace's name when the account knows it, else its id.
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="workspaceslug">
        
      </a>
      
       <code>
        workspaceSlug?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       Default: the workspace's slug when the account knows it, else its id.
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="inviteremail">
        
      </a>
      
       <code>
        inviterEmail?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       Default: <code>
        'inviter@example.com'
      </code>
      
      .
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="id-2">
        
      </a>
      
       <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      <code>
        ReceivedInvitation.id
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="email-1">
        
      </a>
      
       <code>
        email
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      <code>
        ReceivedInvitation.email
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="role-2">
        
      </a>
      
       <code>
        role?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      <code>
        ReceivedInvitation.role
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="status">
        
      </a>
      
       <code>
        status
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      <code>
        ReceivedInvitation.status
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="workspaceid">
        
      </a>
      
       <code>
        workspaceId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      <code>
        ReceivedInvitation.workspaceId
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="inviterid">
        
      </a>
      
       <code>
        inviterId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      <code>
        ReceivedInvitation.inviterId
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="expiresat">
        
      </a>
      
       <code>
        expiresAt
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        number
      </code>
      
       | <code>
        Date
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      <code>
        ReceivedInvitation.expiresAt
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### BackendMockState

Defined in: [src/runtime/test-utils/mock.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts)

**Experimental**

Everything the mock answers from. Reactive: change a field and every
composable reading it follows, as it would follow the live backend.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="user">
        
      </a>
      
       <code>
        user
      </code>
    </td>
    
    <td>
      <a href="#backendmockuser">
        <code>
          BackendMockUser
        </code>
      </a>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       The signed-in account, or <code>
        null
      </code>
      
       while signed out.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="session">
        
      </a>
      
       <code>
        session
      </code>
    </td>
    
    <td>
      { [<code>
        field
      </code>
      
      : <code>
        string
      </code>
      
      ]: <code>
        unknown
      </code>
      
      ; <code>
        id?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        impersonatedBy?
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; }
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       Session fields beyond the ones the mock derives (<code>
        userId
      </code>
      
      , <code>
        activeOrganizationId
      </code>
      
      ); <code>
        id
      </code>
      
       defaults to <code>
        session-<user id>
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        session.id?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        session.impersonatedBy?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="isloading">
        
      </a>
      
       <code>
        isLoading
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       <code>
        true
      </code>
      
       while the session is still being read: the session reads as pending, with no account yet.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="workspaces">
        
      </a>
      
       <code>
        workspaces
      </code>
    </td>
    
    <td>
      <a href="#backendmockworkspace">
        <code>
          BackendMockWorkspace
        </code>
      </a>
      
      <span>
        
      </span>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       The account's workspaces.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="activeworkspace">
        
      </a>
      
       <code>
        activeWorkspace
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       The id of the active workspace, or <code>
        null
      </code>
      
       for none.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="invitations-1">
        
      </a>
      
       <code>
        invitations
      </code>
    </td>
    
    <td>
      <a href="#backendmockinvitation">
        <code>
          BackendMockInvitation
        </code>
      </a>
      
      <span>
        
      </span>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       Invitations sent to the account, which it can accept or decline.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="passkeys">
        
      </a>
      
       <code>
        passkeys
      </code>
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-passkeys#passkey">
        <code>
          Passkey
        </code>
      </a>
      
      <span>
        
      </span>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       The account's passkeys.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="queries">
        
      </a>
      
       <code>
        queries
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        unknown
      </code>
      
      >
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       Query results by function name (<code>
        'billing:getCredits'
      </code>
      
      ): a value, or a function of the query's arguments. A query with no entry, or whose function returns <code>
        undefined
      </code>
      
      , is still loading.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### BackendMockInit

Defined in: [src/runtime/test-utils/mock.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts)

**Experimental**

What [createBackendMock](#createbackendmock) starts from: every field optional, the account partial.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="user-1">
        
      </a>
      
       <code>
        user?
      </code>
    </td>
    
    <td>
      <code>
        Partial
      </code>
      
      <<a href="#backendmockuser">
        <code>
          BackendMockUser
        </code>
      </a>
      
      > | <code>
        null
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       Signed in as this account, its missing fields filled in; <code>
        null
      </code>
      
       or left out: signed out.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="session-1">
        
      </a>
      
       <code>
        session?
      </code>
    </td>
    
    <td>
      { [<code>
        field
      </code>
      
      : <code>
        string
      </code>
      
      ]: <code>
        unknown
      </code>
      
      ; <code>
        id?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        impersonatedBy?
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; }
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        session.id?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        session.impersonatedBy?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="isloading-1">
        
      </a>
      
       <code>
        isLoading?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="workspaces-1">
        
      </a>
      
       <code>
        workspaces?
      </code>
    </td>
    
    <td>
      (<code>
        Partial
      </code>
      
      <<a href="#backendmockworkspace">
        <code>
          BackendMockWorkspace
        </code>
      </a>
      
      > & { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; })<span>
        
      </span>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       Default: one personal workspace the account owns.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="activeworkspace-1">
        
      </a>
      
       <code>
        activeWorkspace?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       Default: the first workspace.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="invitations-2">
        
      </a>
      
       <code>
        invitations?
      </code>
    </td>
    
    <td>
      <a href="#backendmockinvitation">
        <code>
          BackendMockInvitation
        </code>
      </a>
      
      <span>
        
      </span>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="passkeys-1">
        
      </a>
      
       <code>
        passkeys?
      </code>
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-passkeys#passkey">
        <code>
          Passkey
        </code>
      </a>
      
      <span>
        
      </span>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="queries-1">
        
      </a>
      
       <code>
        queries?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        unknown
      </code>
      
      >
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### BackendMockCall

Defined in: [src/runtime/test-utils/mock.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts)

**Experimental**

One call the mock answered: a backend function by its name, or an auth client method by its path.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="kind">
        
      </a>
      
       <code>
        kind
      </code>
    </td>
    
    <td>
      <code>
        "query"
      </code>
      
       | <code>
        "action"
      </code>
      
       | <code>
        "mutation"
      </code>
      
       | <code>
        "auth"
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="name-2">
        
      </a>
      
       <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       <code>
        'billing:generateCheckoutLink'
      </code>
      
       for a function, <code>
        'organization.setActive'
      </code>
      
       for an auth client method.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="args">
        
      </a>
      
       <code>
        args
      </code>
    </td>
    
    <td>
      <code>
        unknown
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### BackendMock

Defined in: [src/runtime/test-utils/mock.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts)

**Experimental**

The fake backend [createBackendMock](#createbackendmock) returns.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Modifier
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="state">
        
      </a>
      
       <code>
        state
      </code>
    </td>
    
    <td>
      <code>
        readonly
      </code>
    </td>
    
    <td>
      <a href="#backendmockstate">
        <code>
          BackendMockState
        </code>
      </a>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       The reactive state every read answers from.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="calls">
        
      </a>
      
       <code>
        calls
      </code>
    </td>
    
    <td>
      <code>
        readonly
      </code>
    </td>
    
    <td>
      <a href="#backendmockcall">
        <code>
          BackendMockCall
        </code>
      </a>
      
      <span>
        
      </span>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       Every mutation, action, one-off query and auth client call, in order.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="callsto">
        
      </a>
      
       <code>
        callsTo
      </code>
    </td>
    
    <td>
      <code>
        public
      </code>
    </td>
    
    <td>
      (<code>
        name
      </code>
      
      ) => <code>
        unknown
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       The arguments of each call to <code>
        name
      </code>
      
      , in order.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="stub">
        
      </a>
      
       <code>
        stub
      </code>
    </td>
    
    <td>
      <code>
        public
      </code>
    </td>
    
    <td>
      (<code>
        name
      </code>
      
      , <code>
        answer
      </code>
      
      ) => <a href="#backendmock">
        <code>
          BackendMock
        </code>
      </a>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       Answer <code>
        name
      </code>
      
       with <code>
        answer(args)
      </code>
      
       from now on: a query's result, a mutation's or action's return value, an auth client method's <code>
        data
      </code>
      
      . A throw (or a rejection) fails the call. Clears a <code>
        fail
      </code>
      
       on the name.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="fail">
        
      </a>
      
       <code>
        fail
      </code>
    </td>
    
    <td>
      <code>
        public
      </code>
    </td>
    
    <td>
      (<code>
        name
      </code>
      
      , <code>
        error
      </code>
      
      ) => <a href="#backendmock">
        <code>
          BackendMock
        </code>
      </a>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       Fail <code>
        name
      </code>
      
       with <code>
        error
      </code>
      
       from now on: a query reads it as its error, a mutation or action rejects with it, and an auth client method answers <code>
        { data: null, error }
      </code>
      
       the way Better Auth's client does. An auth read fails by its hook's name (<code>
        'useActiveOrganization'
      </code>
      
      ; <code>
        'useSession'
      </code>
      
       reads as signed out).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="signin">
        
      </a>
      
       <code>
        signIn
      </code>
    </td>
    
    <td>
      <code>
        public
      </code>
    </td>
    
    <td>
      (<code>
        fields?
      </code>
      
      ) => <a href="#backendmockuser">
        <code>
          BackendMockUser
        </code>
      </a>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       Sign in, as the account the mock started with or a default one, with <code>
        fields
      </code>
      
       over it.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="signout">
        
      </a>
      
       <code>
        signOut
      </code>
    </td>
    
    <td>
      <code>
        public
      </code>
    </td>
    
    <td>
      () => <code>
        void
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       Sign out.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts" rel="nofollow">
        src/runtime/test-utils/mock.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

## Type Aliases

### BackendMockName

```ts
type BackendMockName = 
  | string
| FunctionReference<"query" | "mutation" | "action", "public" | "internal">;
```

Defined in: [src/runtime/test-utils/mock.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts)

**Experimental**

A backend function by name (`'billing:getCredits'`) or reference
(`api.billing.getCredits`), or an auth client method by its path
(`'organization.setActive'`, `'signIn.emailOtp'`).

## Functions

### backendTestAliases()

```ts
function backendTestAliases(): Record<string, string>;
```

Defined in: [src/runtime/test-utils/aliases.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/aliases.ts)

**Experimental**

Vite aliases that put [createBackendMock](#createbackendmock) under the package's
composables and components and the base module's own. Three imports are
swapped:

- `#convex/auth-client`, the Better Auth client the session layer is built
on (`useAuth`, `useBetterAuth`, the page guard), which the base module
loads on first use, for one that answers from the mock;
- `nuxt-convex-module/client` and `nuxt-convex-module/vue`, for the base
module's own entry with every export kept, whose composables also
provide the mock where a plain `mount()` needs it.

One private name reaches the base module's real entry for that stand-in;
the session state the base module keeps between tests is reset through its
public `nuxt-convex-module/testing`. With the aliases in a Vitest project,
a test needs no `vi.mock`.

Use them in a project with `@nuxt/test-utils`' `nuxt` environment
(`defineVitestProject`, or `defineVitestConfig` for a single project): it
transforms the package and the base module, which is where the aliases
apply. Keep tests that need a live deployment in a project without them.

#### Returns

`Record`<`string`, `string`>

#### Example

```ts [vitest.config.ts]
import { defineConfig } from 'vitest/config'
import { defineVitestProject } from '@nuxt/test-utils/config'
import { backendTestAliases } from 'nuxt-backend/test-utils'

export default defineConfig({
  test: {
    projects: [
      await defineVitestProject({
        resolve: { alias: backendTestAliases() },
        test: { name: 'app', include: ['test/app/*.test.ts'], environment: 'nuxt' },
      }),
    ],
  },
})
```

---

### renderEmail()

```ts
function renderEmail<Name>(
   name, 
   data, 
   options?
): Promise<EmailMessage>;
```

Defined in: [src/runtime/test-utils/email.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/email.ts)

**Experimental**

Render one of the emails the package sends, as `setupEmail` with the same
options would send it, without a deployment: the template in effect (an
override in `templates`, else the packaged one) in the shared layout, in
`locale` read through `messages`. Pass the options your
`backend/email.ts` gives `setupEmail` (`templates`, `messages`,
`defaultLocale`, `localePaths`, `brand`, `theme`) to test what your users get.
Experimental, with the rest of `nuxt-backend/test-utils`.

#### Type Parameters

<table>
<thead>
  <tr>
    <th>
      Type Parameter
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="type-parameter-name">
        
      </a>
      
       <code>
        Name
      </code>
      
       <em>
        extends
      </em>
      
       keyof <a href="https://nuxt-backend.dev/docs/reference/api/email#emailtemplates">
        <code>
          EmailTemplates
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        Name
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        data
      </code>
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/email#emailtemplatedata">
        <code>
          EmailTemplateData
        </code>
      </a>
      
      <<code>
        Name
      </code>
      
      >
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="#renderemailoptions">
        <code>
          RenderEmailOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

#### Returns

`Promise`<[`EmailMessage`](https://nuxt-backend.dev/docs/reference/api/email#emailmessage)>

#### Example

```ts
import { renderEmail } from 'nuxt-backend/test-utils'
import de from '../i18n/locales/de.json'

const message = await renderEmail('welcome', { email: 'ada@example.com', name: 'Ada' }, { locale: 'de', messages: { de } })
expect(message.subject).toBe('Willkommen')
```

---

### createBackendMock()

```ts
function createBackendMock(init?): BackendMock;
```

Defined in: [src/runtime/test-utils/mock.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts)

**Experimental**

A fake backend for an app's component and page tests: the package's
composables and components, and the base module's own (`useQuery`,
`<Authenticated>`, the page guard, …), read it instead of a
deployment once [backendTestAliases](#backendtestaliases) is in the Vitest project.
Queries answer from `state.queries`; mutations, actions and auth client
calls are recorded in `calls` and answer what `stub` says (or a built-in
answer for the auth flows: signing in, switching workspace, …); `fail`
makes any of them fail. The state is reactive: change it in a test and
the rendered page follows.

The newest mock is the one everything reads, so make one per test, in a
`beforeEach` or the test itself. Signed out unless `user` is given.

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        init?
      </code>
    </td>
    
    <td>
      <a href="#backendmockinit">
        <code>
          BackendMockInit
        </code>
      </a>
    </td>
    
    <td>
      The starting state: the account, its workspaces, query results.
    </td>
  </tr>
</tbody>
</table>

#### Returns

[`BackendMock`](#backendmock)

#### Example

```ts
import { createBackendMock } from 'nuxt-backend/test-utils'
import { mountSuspended } from '@nuxt/test-utils/runtime'
import { flushPromises } from '@vue/test-utils'
import { expect, test } from 'vitest'
import CreditsPage from '~/pages/credits.vue'

test('the balance follows the backend', async () => {
  const backend = createBackendMock({
    user: { name: 'Ada' },
    queries: { 'billing:getCredits': { meters: [{ meterId: 'm1', name: 'credits', balance: 42 }] } },
  })
  const page = await mountSuspended(CreditsPage)
  expect(page.text()).toContain('42')

  backend.state.queries['billing:getCredits'] = { meters: [{ meterId: 'm1', name: 'credits', balance: 0 }] }
  await flushPromises()
  expect(page.text()).toContain('0')
})
```

---

### resetBackendMock()

```ts
function resetBackendMock(): void;
```

Defined in: [src/runtime/test-utils/mock.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts)

**Experimental**

Forget every mock: the active one, the signed-out fallback and the
session token the auth layer cached. The next read answers from a fresh
signed-out mock until a test makes its own.

#### Returns

`void`

---

### backendMockProvides()

```ts
function backendMockProvides(): Record<symbol, unknown>;
```

Defined in: [src/runtime/test-utils/mock.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/test-utils/mock.ts)

**Experimental**

The mock's client and auth state under the base module's keys and its
function tree under this package's, for a plain `mount()`: `mountSuspended` copies them from the
Nuxt app, where each new mock is provided, but `mount()` starts an app of
its own. Pass them as `global.provide`. Throws when the aliases are not in
the Vitest project.

#### Returns

`Record`<`symbol`, `unknown`>

#### Example

```ts
import { mount } from '@vue/test-utils'
import { backendMockProvides, createBackendMock } from 'nuxt-backend/test-utils'

createBackendMock({ user: { name: 'Ada' } })
const page = mount(Dashboard, { global: { provide: backendMockProvides() } })
```


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
