Skip to content

Commit 6f7d557

Browse files
committed
Final proof
1 parent 28711d2 commit 6f7d557

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

app/tests/firestore/web_client/page.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
*/
1717
import type { Metadata } from 'next'
1818
import CSRTestRunner from '@/components/app_tests/firestore/csr_test_runner';
19-
import { buildSerializedFirestoreData, SerializedFirestoreData } from '@/lib/app_tests/firestore/test';
19+
import {
20+
buildSerializedFirestoreData,
21+
SerializedFirestoreData
22+
} from '@/lib/app_tests/firestore/test';
2023

2124
export const metadata: Metadata = {
2225
title: 'Firestore Web SDK CSR test'

src/lib/app_tests/firestore/test.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export type TestResults = {
8080
getDeletedDocResult: string,
8181
deleteAppResult: string,
8282

83-
// Tests that are only specific to the desrialization of Firestore
83+
// Tests that are only specific to the deserialization of Firestore
8484
// types within the CSR phase.
8585
csrDocumentSnapshotResult: string,
8686
csrDocumentSnapshotOnResumeResult: string,
@@ -146,7 +146,7 @@ export type SerializedFirestoreData = {
146146

147147
/**
148148
* Util function that ensures the document in the Firestore service instance
149-
* is of the same type as we expect in these tests.
149+
* is of the same shape as this version of the tests expect.
150150
*/
151151
async function setExpectedSerializedDataInFirestore(firestore, path) {
152152
const docRef = doc(firestore, path);
@@ -160,14 +160,14 @@ async function setExpectedSerializedDataInFirestore(firestore, path) {
160160
}
161161

162162
/**
163-
* Returns a populated {@link SerializedFirestoreData} with Json serialized data.
163+
* Returns a populated {@link SerializedFirestoreData} with JSON serialized data.
164164
* This data can be validated by invoking {@link testSerializedFirestoreData}.
165165
*
166166
* The intended flow is for the CSR tests to render a page with both SSR and CSR logic.
167-
* The SSR logic builds out this serialized data. The data is then passed to the CSR
167+
* The SSR logic builds out this serialized data which is then passed to the CSR
168168
* phase via Next JS component parameters. The CSR component then invokes {@link
169-
* testSerializedFirestoreData} to deserialized the data and ensure it matches
170-
* the expected values.
169+
* testSerializedFirestoreData} to deserialized the data and test it to ensure it
170+
* matches the expected values.
171171
*/
172172
export async function buildSerializedFirestoreData(): Promise<SerializedFirestoreData> {
173173
const QUERY_PATH = '/nextJsTestStaticCollection_DoNotDelete';
@@ -207,6 +207,9 @@ export async function buildSerializedFirestoreData(): Promise<SerializedFirestor
207207
}
208208

209209
/**
210+
* Tests that the Firestore objects can be desieralized and that their values
211+
* match the original values that they were serialized from. See
212+
* {@link buildSerializedFirestoreData} for more information.
210213
*
211214
* @param testResults the state tests that may have already been executed.
212215
* @param serializedFirestoreData an instance of the data that was JSON serialized
@@ -312,7 +315,7 @@ export async function testSerializedFirestoreData(
312315

313316
/**
314317
* Ensures the content of the document queried from Firestore matches the
315-
* format that the tests expect.
318+
* format the tests expect.
316319
*/
317320
export function validateDocumentData(documentData): boolean {
318321
if (documentData !== undefined) {

0 commit comments

Comments
 (0)