Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Type aliases

Variables

Functions

Type aliases

App

App: ReturnType<initializeTestApp> | ReturnType<initializeAdminApp>

Variables

Let currentApp

currentApp: App

Functions

injectTestingAdaptor

  • injectTestingAdaptor(app: App): void
  • Injects @firebase/testing adaptod instead of firebase-admin and set the given app to be used for Firestore operations.

    import * as testing from '@firebase/testing'
    import { injectTestingAdaptor } from 'typesaurus/testing'
    
    // To initialize and inject an admin app (with exclusive access to the DB):
    injectTestingAdaptor(testing.initializeAdminApp({ projectId: 'project-id' }))
    
    // To initialize and inject a client app (with given authentication details):
    injectTestingAdaptor(
      testing.initializeTestApp({
        projectId: 'project-id',
        auth: { uid: 'user-id' }
      })
    )
    // Load security rules:
    await testing.loadFirestoreRules({
      projectId: 'project-id',
      rules: '' // Security rules string
    })

    Parameters

    • app: App

      The testing app instance

    Returns void

setApp

  • setApp(app: App): void
  • Sets the given app to be used for Firestore operations. Must be used after calling injectTestingAdaptor.

    import * as testing from '@firebase/testing'
    import { injectTestingAdaptor, setApp } from 'typesaurus/testing'
    
    // Initialize as not authenticated:
    injectTestingAdaptor(
      testing.initializeTestApp({
        projectId: 'project-id',
        auth: null
      })
    )
    
    // Authenticate user with user-id as the id:
    setApp(
      testing.initializeTestApp({
        projectId: 'project-id',
        auth: { user: 'user-id' }
      })
    )

    Parameters

    • app: App

      The testing app instance

    Returns void

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc