How to use the @posva/vuefire-test-helpers.delayUpdate function in @posva/vuefire-test-helpers

To help you get started, we’ve selected a few @posva/vuefire-test-helpers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vuejs / vuefire / packages / vuefire / __tests__ / firestore / bind.spec.ts View on Github external
test('waits for all refs in document with interrupting by new ref', async () => {
    const a = db.collection().doc()
    // @ts-ignore
    const b: firestore.DocumentReference = db.collection().doc()
    const c = db.collection().doc()
    delayUpdate(b)
    await document.update({ a, b })

    const promise = vm.$bind('item', document)

    document.update({ c })

    await promise

    expect(vm.item).toEqual({
      a: null,
      b: null,
      c: null,
    })
  })
github vuejs / vuefire / packages / vuexfire / __tests__ / firestore.spec.ts View on Github external
it('waits for all refs in document with interrupting by new ref', async () => {
    const a = db.collection().doc()
    // @ts-ignore
    const b: firestore.DocumentReference = db.collection().doc()
    const c = db.collection().doc()
    delayUpdate(b)
    await document.update({ a, b })

    const promise = setItem(document)

    document.update({ c })

    await promise

    expect(store.state.item).toEqual({
      a: null,
      b: null,
      c: null,
    })
  })
github vuejs / vuefire / packages / vuexfire / __tests__ / firestore.spec.ts View on Github external
it('waits for nested refs with data in collections', async () => {
    const a = db.collection().doc()
    // @ts-ignore
    const b: firestore.DocumentReference = db.collection().doc()
    // @ts-ignore
    const c: firestore.DocumentReference = db.collection().doc()
    await a.update({ isA: true })
    await c.update({ isC: true })
    await b.update({ c })
    delayUpdate(b)
    delayUpdate(c, 5)
    await collection.add({ a })
    await collection.add({ b })

    await setItems(collection)

    expect(store.state.items).toEqual([{ a: { isA: true } }, { b: { c: { isC: true } } }])
  })
github vuejs / vuefire / packages / vuefire / __tests__ / firestore / bind.spec.ts View on Github external
it('waits for nested refs in collections', async () => {
    const a = db.collection().doc()
    // @ts-ignore
    const b: firestore.DocumentReference = db.collection().doc()
    // @ts-ignore
    const c: firestore.DocumentReference = db.collection().doc()
    await b.update({ c })
    delayUpdate(b)
    delayUpdate(c, 5)
    await collection.add({ a })
    await collection.add({ b })

    await vm.$bind('items', collection)

    expect(vm.items).toEqual([{ a: null }, { b: { c: null } }])
  })
github vuejs / vuefire / packages / @posva / vuefire-core / __tests__ / firestore / refs-collections.spec.ts View on Github external
it('waits for array to be fully populated', async () => {
    const c = db.collection().doc()
    await c.update({ isC: true })
    await collection.add({ ref: c })
    // force callback delay

    // @ts-ignore
    delayUpdate(c)
    const data = await bind('items', collection)

    expect(data).toEqual(vm.items)
    expect(vm.items).toEqual([
      { ref: { isA: true } },
      { ref: { isB: true } },
      { ref: { isC: true } },
    ])
  })