1717
1818import { deleteApp , initializeApp } from 'firebase/app' ;
1919import {
20+ Bytes ,
2021 collection ,
2122 DocumentSnapshot ,
2223 deleteDoc ,
2324 doc ,
2425 documentSnapshotFromJSON ,
26+ GeoPoint ,
2527 getDoc ,
2628 getDocs ,
2729 getFirestore ,
2830 onSnapshot ,
2931 onSnapshotResume ,
32+ QuerySnapshot ,
3033 query ,
3134 querySnapshotFromJSON ,
32- QuerySnapshot ,
3335 setDoc ,
36+ Timestamp ,
3437 updateDoc ,
35-
38+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
39+ VectorValue ,
40+ vector
3641} from 'firebase/firestore' ;
3742import { firebaseConfig } from '@/lib/app_tests/firebase' ;
3843import { OK , FAILED , OK_SKIPPED } from '@/lib/app_tests/util' ;
@@ -63,6 +68,10 @@ export type TestResults = {
6368 clientSideDocumentSnapshotOnResumeResult : string ,
6469 clientSideQuerySnapshotResult : string
6570 clientSideQuerySnapshotOnResumeResult : string ,
71+ clientSideDeserializedBytesResult : string ,
72+ clientSideDeserializedGeoPointResult : string ,
73+ clientSideDeserializedTimestampResult : string ,
74+ clientSideDeserializedVectorValueResult : string
6675} ;
6776
6877export function initializeTestResults ( ) : TestResults {
@@ -91,13 +100,21 @@ export function initializeTestResults(): TestResults {
91100 clientSideDocumentSnapshotResult : FAILED ,
92101 clientSideDocumentSnapshotOnResumeResult : FAILED ,
93102 clientSideQuerySnapshotResult : FAILED ,
94- clientSideQuerySnapshotOnResumeResult : FAILED
103+ clientSideQuerySnapshotOnResumeResult : FAILED ,
104+ clientSideDeserializedBytesResult : FAILED ,
105+ clientSideDeserializedGeoPointResult : FAILED ,
106+ clientSideDeserializedTimestampResult : FAILED ,
107+ clientSideDeserializedVectorValueResult : FAILED
95108 } ;
96109}
97110
98111export type SerializedFirestoreData = {
99112 documentSnapshotJson : object | null ,
100113 querySnapshotJson : object | null ,
114+ bytesJson : object | null ,
115+ geoPointJson : object | null ,
116+ timestampJson : object | null ,
117+ vectorValueJson : object | null
101118}
102119
103120export async function setExpectedSerializedDataInFirestore ( firestore , path ) {
@@ -116,7 +133,11 @@ export async function buildSerializedFirestoreData(): Promise<SerializedFirestor
116133 const DOCUMENT_PATH = QUERY_PATH + '/doc' ;
117134 const result : SerializedFirestoreData = {
118135 documentSnapshotJson : null ,
119- querySnapshotJson : null
136+ querySnapshotJson : null ,
137+ bytesJson : null ,
138+ geoPointJson : null ,
139+ timestampJson : null ,
140+ vectorValueJson : null
120141 } ;
121142
122143 const firebaseApp = initializeApp ( firebaseConfig ) ;
@@ -136,6 +157,13 @@ export async function buildSerializedFirestoreData(): Promise<SerializedFirestor
136157 result . querySnapshotJson = querySnapshot . toJSON ( ) ;
137158 }
138159
160+ result . bytesJson = Bytes . fromUint8Array ( new Uint8Array ( [ 0 , 1 , 2 , 3 , 4 , 5 ] ) ) . toJSON ( ) ;
161+ result . geoPointJson = new GeoPoint ( 1 , 2 ) . toJSON ( ) ;
162+ result . timestampJson = new Timestamp ( 123 , 456 ) . toJSON ( ) ;
163+ const num : number [ ] = [ 1 , 2 , 3 ] ;
164+
165+ result . vectorValueJson = vector ( num ) . toJSON ( ) ;
166+
139167 return result ;
140168}
141169
@@ -149,6 +177,10 @@ export async function testFirestore(isServer: boolean = false): Promise<TestResu
149177 result . clientSideDocumentSnapshotOnResumeResult = OK_SKIPPED ;
150178 result . clientSideQuerySnapshotResult = OK_SKIPPED ;
151179 result . clientSideQuerySnapshotOnResumeResult = OK_SKIPPED ;
180+ result . clientSideDeserializedBytesResult = OK_SKIPPED ;
181+ result . clientSideDeserializedGeoPointResult = OK_SKIPPED ;
182+ result . clientSideDeserializedTimestampResult = OK_SKIPPED ;
183+ result . clientSideDeserializedVectorValueResult = OK_SKIPPED ;
152184 }
153185
154186 try {
0 commit comments