Skip to content

Firestore: remove explicit type from persistence argument in integration tests #7405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,164 changes: 1,078 additions & 1,086 deletions packages/firestore/test/integration/api/aggregation.test.ts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ addEqualityMatcher();
* together, etc.) and so these tests mostly focus on the array transform
* semantics.
*/
apiDescribe('Array Transforms:', (persistence: boolean) => {
apiDescribe('Array Transforms:', persistence => {
// A document reference to read and write to.
let docRef: DocumentReference;

Expand Down
4 changes: 2 additions & 2 deletions packages/firestore/test/integration/api/batch_writes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import {
withTestDoc
} from '../util/helpers';

apiDescribe('Database batch writes', (persistence: boolean) => {
apiDescribe('Database batch writes', persistence => {
it('supports empty batches', () => {
return withTestDb(persistence, db => {
return writeBatch(db).commit();
Expand Down Expand Up @@ -329,7 +329,7 @@ apiDescribe('Database batch writes', (persistence: boolean) => {

// PORTING NOTE: These tests are for FirestoreDataConverter support and apply
// only to web.
apiDescribe('withConverter() support', (persistence: boolean) => {
apiDescribe('withConverter() support', persistence => {
class Post {
constructor(readonly title: string, readonly author: string) {}
byline(): string {
Expand Down
2 changes: 1 addition & 1 deletion packages/firestore/test/integration/api/bundle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const BUNDLE_TEMPLATE = [
'{"document":{"name":"projects/{0}/databases/(default)/documents/coll-1/b","createTime":{"seconds":1,"nanos":9},"updateTime":{"seconds":1,"nanos":9},"fields":{"k":{"stringValue":"b"},"bar":{"integerValue":2}}}}'
];

apiDescribe('Bundles', (persistence: boolean) => {
apiDescribe('Bundles', persistence => {
function verifySnapEqualsTestDocs(snap: QuerySnapshot): void {
expect(toDataArray(snap)).to.deep.equal([
{ k: 'a', bar: 1 },
Expand Down
2 changes: 1 addition & 1 deletion packages/firestore/test/integration/api/cursor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import {
withTestDbs
} from '../util/helpers';

apiDescribe('Cursors', (persistence: boolean) => {
apiDescribe('Cursors', persistence => {
it('can page through items', () => {
const testDocs = {
a: { v: 'a' },
Expand Down
6 changes: 3 additions & 3 deletions packages/firestore/test/integration/api/database.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ import { DEFAULT_SETTINGS, DEFAULT_PROJECT_ID } from '../util/settings';

use(chaiAsPromised);

apiDescribe('Database', (persistence: boolean) => {
apiDescribe('Database', persistence => {
it('can set a document', () => {
return withTestDoc(persistence, docRef => {
return setDoc(docRef, {
Expand Down Expand Up @@ -638,7 +638,7 @@ apiDescribe('Database', (persistence: boolean) => {
});
});

apiDescribe('Queries are validated client-side', (persistence: boolean) => {
apiDescribe('Queries are validated client-side', persistence => {
// NOTE: Failure cases are validated in validation_test.ts

it('same inequality fields works', () => {
Expand Down Expand Up @@ -1340,7 +1340,7 @@ apiDescribe('Database', (persistence: boolean) => {

// PORTING NOTE: These tests are for FirestoreDataConverter support and apply
// only to web.
apiDescribe('withConverter() support', (persistence: boolean) => {
apiDescribe('withConverter() support', persistence => {
class Post {
constructor(
readonly title: string,
Expand Down
8 changes: 4 additions & 4 deletions packages/firestore/test/integration/api/fields.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import { DEFAULT_SETTINGS } from '../util/settings';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type AnyTestData = any;

apiDescribe('Nested Fields', (persistence: boolean) => {
apiDescribe('Nested Fields', persistence => {
const testData = (n?: number): AnyTestData => {
n = n || 1;
return {
Expand Down Expand Up @@ -240,7 +240,7 @@ apiDescribe('Nested Fields', (persistence: boolean) => {
// NOTE(mikelehen): I originally combined these tests with the above ones, but
// Datastore currently prohibits having nested fields and fields with dots in
// the same entity, so I'm separating them.
apiDescribe('Fields with special characters', (persistence: boolean) => {
apiDescribe('Fields with special characters', persistence => {
const testData = (n?: number): AnyTestData => {
n = n || 1;
return {
Expand Down Expand Up @@ -340,7 +340,7 @@ apiDescribe('Fields with special characters', (persistence: boolean) => {
});
});

apiDescribe('Timestamp Fields in snapshots', (persistence: boolean) => {
apiDescribe('Timestamp Fields in snapshots', persistence => {
// Figure out how to pass in the Timestamp type
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const testDataWithTimestamps = (ts: any): AnyTestData => {
Expand Down Expand Up @@ -379,7 +379,7 @@ apiDescribe('Timestamp Fields in snapshots', (persistence: boolean) => {
});
});

apiDescribe('`undefined` properties', (persistence: boolean) => {
apiDescribe('`undefined` properties', persistence => {
const settings = { ...DEFAULT_SETTINGS };
settings.ignoreUndefinedProperties = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {
withEnsuredLruGcTestDb
} from '../util/helpers';

apiDescribe('GetOptions', (persistence: boolean) => {
apiDescribe('GetOptions', persistence => {
it('get document while online with default get options', () => {
const initialData = { key: 'value' };
return withTestDocAndInitialData(persistence, initialData, docRef => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { expect } from 'chai';
import { setIndexConfiguration } from '../util/firebase_export';
import { apiDescribe, withTestDb } from '../util/helpers';

apiDescribe('Index Configuration:', (persistence: boolean) => {
apiDescribe('Index Configuration:', persistence => {
it('supports JSON', () => {
return withTestDb(persistence, async db => {
return setIndexConfiguration(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { apiDescribe, withTestDoc } from '../util/helpers';

const DOUBLE_EPSILON = 0.000001;

apiDescribe('Numeric Transforms:', (persistence: boolean) => {
apiDescribe('Numeric Transforms:', persistence => {
// A document reference to read and write to.
let docRef: DocumentReference;

Expand Down
2 changes: 1 addition & 1 deletion packages/firestore/test/integration/api/query.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ import {
import { USE_EMULATOR } from '../util/settings';
import { captureExistenceFilterMismatches } from '../util/testing_hooks_util';

apiDescribe('Queries', (persistence: boolean) => {
apiDescribe('Queries', persistence => {
addEqualityMatcher();

it('can issue limit queries', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { apiDescribe, withTestDoc } from '../util/helpers';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type AnyTestData = any;

apiDescribe('Server Timestamps', (persistence: boolean) => {
apiDescribe('Server Timestamps', persistence => {
// Data written in tests via set().
const setData = {
a: 42,
Expand Down
2 changes: 1 addition & 1 deletion packages/firestore/test/integration/api/smoke.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {
withTestDoc
} from '../util/helpers';

apiDescribe('Smoke Test', (persistence: boolean) => {
apiDescribe('Smoke Test', persistence => {
it('can write a single document', () => {
return withTestDoc(persistence, ref => {
return setDoc(ref, {
Expand Down
4 changes: 2 additions & 2 deletions packages/firestore/test/integration/api/transactions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {
} from '../util/firebase_export';
import { apiDescribe, withTestDb } from '../util/helpers';

apiDescribe('Database transactions', (persistence: boolean) => {
apiDescribe('Database transactions', persistence => {
type TransactionStage = (
transaction: Transaction,
docRef: DocumentReference
Expand Down Expand Up @@ -704,7 +704,7 @@ apiDescribe('Database transactions', (persistence: boolean) => {

// PORTING NOTE: These tests are for FirestoreDataConverter support and apply
// only to web.
apiDescribe('withConverter() support', (persistence: boolean) => {
apiDescribe('withConverter() support', persistence => {
class Post {
constructor(readonly title: string, readonly author: string) {}
byline(): string {
Expand Down
2 changes: 1 addition & 1 deletion packages/firestore/test/integration/api/type.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {
} from '../util/firebase_export';
import { apiDescribe, withTestDb, withTestDoc } from '../util/helpers';

apiDescribe('Firestore', (persistence: boolean) => {
apiDescribe('Firestore', persistence => {
addEqualityMatcher();

async function expectRoundtrip(
Expand Down
2 changes: 1 addition & 1 deletion packages/firestore/test/integration/api/validation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class TestClass {
constructor(readonly property: string) {}
}

apiDescribe('Validation:', (persistence: boolean) => {
apiDescribe('Validation:', persistence => {
describe('FirestoreSettings', () => {
// Enabling persistence counts as a use of the firestore instance, meaning
// that it will be impossible to verify that a set of settings don't throw,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { withMockCredentialProviderTestDb } from '../util/internal_helpers';

use(chaiAsPromised);

apiDescribe('Database (with internal API)', (persistence: boolean) => {
apiDescribe('Database (with internal API)', persistence => {
// eslint-disable-next-line no-restricted-properties
(persistence ? it : it.skip)(
'will reject the promise if clear persistence fails',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { collection, doc, onSnapshot, setDoc } from '../util/firebase_export';
import { apiDescribe, withTestDb } from '../util/helpers';
import { asyncQueue } from '../util/internal_helpers';

apiDescribe('Idle Timeout', (persistence: boolean) => {
apiDescribe('Idle Timeout', persistence => {
it('can write document after idle timeout', () => {
return withTestDb(persistence, db => {
const docRef = doc(collection(db, 'test-collection'));
Expand Down
Loading