import test from 'ava' ; import { doc , collection , onSnapshot } from 'firebase/firestore' ; import { db } from './initFirebase' ; import { waitMs } from '@magnetarjs/test-utils' ; test ( 'firebase sdk' , async ( t ) => { const pokemonPath = `magnetarTests/read/pokedex/136` ; console . log ( `1)` ) ; await onSnapshot ( doc ( db , pokemonPath ) , { includeMetadataChanges : false } , async ( querySnapshot ) => { console . log ( `doc(${ pokemonPath }).onSnapshot
  querySnapshot.metadata.fromCache → ` , querySnapshot . metadata . fromCache ) ; console . log ( `keys that change order... → ` , Object . keys ( querySnapshot . data ( ) || { } ) ) ; } ) ; await waitMs ( 2000 ) ; const pokedexPath = `magnetarTests/read/pokedex` ; console . log ( `\n2)` ) ; await onSnapshot ( collection ( db , pokedexPath ) , { includeMetadataChanges : false } , async ( querySnapshot ) => { console . log ( `collection(${ pokedexPath }).onSnapshot
  querySnapshot.metadata.fromCache → ` , querySnapshot . metadata . fromCache ) ; console . log ( `querySnapshot.size → ` , querySnapshot . size ) ; } ) ; await waitMs ( 1000 ) ; } ) ;