Skip to content

Add an integration test for calling clearPersistence() on a new Firestore instance #3005

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
May 4, 2020

Conversation

dconeybe
Copy link
Contributor

@dconeybe dconeybe commented May 1, 2020

No description provided.

await app.delete();
const app2 = firebase.initializeApp(options, name);
const firestore2 = firebase.firestore!(app2);
await firestore2.clearPersistence();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the only difference between this test case and the one above it is that the location of the call to clearPersistence() has moved to be invoked on the newly-created firestore2 object.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checking - is this test meaningfully different from:

// eslint-disable-next-line no-restricted-properties
(persistence ? it : it.skip)( 'can clear persistence if the client has not been initialized',
  () => withTestDb(db => db.clearPersistence())
)

You should also update your PR title. You are writing a super fancy integration test, and not a unit test :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "difference" between that 1-line test is that it doesn't verify the side effects of clearPersistence(). Unfortunately, the extra lines all exist to provide the verification that clearPersistence() does indeed clear the persistence. Also, I will update the PR description as suggested.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. I did not quite catch that the first time around.

@google-oss-bot
Copy link
Contributor

google-oss-bot commented May 1, 2020

Binary Size Report

Affected SDKs

No changes between base commit (e03614c) and head commit (29798da).

Test Logs

@dconeybe dconeybe requested a review from schmidt-sebastian May 1, 2020 19:11
@dconeybe dconeybe changed the title Add a unit test for calling clearPersistence() on a new Firestore instance Add an integration test for calling clearPersistence() on a new Firestore instance May 4, 2020
@dconeybe dconeybe merged commit df44d12 into master May 4, 2020
@dconeybe dconeybe deleted the dconeybe/ClearPersistenceUnitTest branch May 4, 2020 16:48
scottcrossen pushed a commit that referenced this pull request May 4, 2020
@firebase firebase locked and limited conversation to collaborators Jun 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants