-
Notifications
You must be signed in to change notification settings - Fork 929
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
Conversation
await app.delete(); | ||
const app2 = firebase.initializeApp(options, name); | ||
const firestore2 = firebase.firestore!(app2); | ||
await firestore2.clearPersistence(); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
No description provided.