Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { rtdbPlugin } from '../../src'
import { Vue, tick, MockFirebase } from '@posva/vuefire-test-helpers'
Vue.use(rtdbPlugin)
describe('RTDB: manual bind', () => {
async function createVm() {
const source = new MockFirebase().child('data')
const vm = new Vue({
// purposely set items as null
// but it's a good practice to set it to an empty array
data: () => ({
items: [],
item: null,
}),
})
await tick()
return { vm, source }
}
import { firestorePlugin } from '../../src'
import { db, tick, delayUpdate, Vue } from '@posva/vuefire-test-helpers'
import { firestore } from 'firebase'
import { CombinedVueInstance } from 'vue/types/vue'
Vue.use(firestorePlugin)
describe('Firestore: binding', () => {
let collection: firestore.CollectionReference,
document: firestore.DocumentReference,
vm: CombinedVueInstance>
beforeEach(async () => {
// @ts-ignore
collection = db.collection()
// @ts-ignore
document = db.collection().doc()
// @ts-ignore
vm = new Vue({
// purposely set items as null
// but it's a good practice to set it to an empty array
data: () => ({
items: null,
import Vuex from 'vuex'
import { vuexfireMutations, firestoreAction } from '../src'
import { db, tick, Vue, delayUpdate } from '@posva/vuefire-test-helpers'
import { firestore } from 'firebase'
import { FirestoreOptions } from '@posva/vuefire-core/dist/packages/@posva/vuefire-core/src'
Vue.use(Vuex)
describe('firestoreAction', () => {
const item: any = null,
items: any[] = []
const store = new Vuex.Store<{ item: any; items: any[] }>({
state: { item, items },
mutations: vuexfireMutations,
actions: {
action: firestoreAction((context, fn) => fn(context)),
},
modules: {
module: {
namespaced: true,
actions: {
action: firestoreAction((context, fn) => fn(context)),
import Vuex from 'vuex'
import { vuexfireMutations, firestoreAction } from '../src'
import { db, tick, Vue } from '@posva/vuefire-test-helpers'
import { firestore } from 'firebase'
import { FirestoreOptions } from '@posva/vuefire-core/dist/packages/@posva/vuefire-core/src'
Vue.use(Vuex)
describe('firestoreAction', () => {
const item: any = null,
items: any[] = []
const store = new Vuex.Store<{ item: any; items: any[] }>({
state: { item, items },
mutations: vuexfireMutations,
actions: {
action: firestoreAction((context, fn) => fn(context)),
},
modules: {
module: {
namespaced: true,
actions: {
action: firestoreAction((context, fn) => fn(context)),
import Vuex from 'vuex'
import { firebaseAction, vuexfireMutations } from '../src'
import { MockFirebase, tick, Vue } from '@posva/vuefire-test-helpers'
import { database } from 'firebase'
import { RTDBOptions } from '@posva/vuefire-core/dist/packages/@posva/vuefire-core/src'
Vue.use(Vuex)
const db = new MockFirebase().child('data')
describe('RTDB: firebaseAction', () => {
const item: any = null,
items: any[] = []
const store = new Vuex.Store<{ item: any; items: any[] }>({
state: { items, item },
mutations: vuexfireMutations,
actions: {
action: firebaseAction((context, fn) => fn(context)),
},
modules: {
module: {
namespaced: true,