Skip to content

⬅️ Back to Table of Contents

📄 index.test.ts

📊 Analysis Summary

Metric Count
🔧 Functions 4
📦 Imports 15
📊 Variables & Constants 2
🟢 Vue Composition API 4

📚 Table of Contents

🛠️ File Location:

📂 packages/firebase/useFirestore/index.test.ts

📦 Imports

Name Source
Firestore firebase/firestore
collection firebase/firestore
doc firebase/firestore
afterEach vitest
beforeEach vitest
describe vitest
expect vitest
it vitest
vi vitest
computed vue
deepRef vue
effectScope vue
nextTick vue
shallowRef vue
useFirestore ./index

Variables & Constants

Name Type Kind Value Exported
dummyFirestore Firestore const {} as Firestore
data any let/var *not shown*

Vue Composition API

Name Type Reactive Variables Composables
computed computed none none
computed computed none none
computed computed none none
computed computed none none

Functions

getMockSnapFromRef(docRef: any): { id: string; data: () => any; }

Code
function getMockSnapFromRef(docRef: any) {
  return {
    id: `${docRef.path}-id`,
    data: () => docRef.path === 'users/invalid' ? null : docRef,
  }
}
  • Parameters:
  • docRef: any
  • Return Type: { id: string; data: () => any; }

data(): any

Code
() => docRef.path === 'users/invalid' ? null : docRef
  • Return Type: any

data(): any

Code
() => docRef.path === 'users/invalid' ? null : docRef
  • Return Type: any

getData(docRef: any): any

Code
function getData(docRef: any) {
  const data = docRef.data()
  if (data) {
    Object.defineProperty(data, 'id', {
      value: docRef.id.toString(),
      writable: false,
    })
  }
  return data
}
  • Parameters:
  • docRef: any
  • Return Type: any
  • Calls:
  • docRef.data
  • Object.defineProperty
  • docRef.id.toString