Skip to content

check client offline state and test #6579

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 7 commits into from
Sep 7, 2022
Merged

Conversation

milaGGL
Copy link
Contributor

@milaGGL milaGGL commented Sep 1, 2022

  • throw error if user is offline and calling getAggregatefromServerDirect
  • add a test case

@changeset-bot
Copy link

changeset-bot bot commented Sep 1, 2022

⚠️ No Changeset found

Latest commit: 745ef76

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

if (!canUseNetwork(remoteStore)) {
logDebug(
LOG_TAG,
'The network is disabled. The task returned by ' +
Copy link
Contributor

Choose a reason for hiding this comment

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

This debug message is somewhat misleading. First, the getAggregateFromServerDirect() function is going to be renamed. Second, it implies that the promise will be automatically resolved once network connectivity is restored. What do you think about just removing this log message altogether?

@@ -38,4 +39,23 @@ apiDescribe('Aggregation query', (persistence: boolean) => {
expect(snapshot.getCount()).to.equal(3);
});
});

it('getAggregateFromServerDirect fails if user is offline async', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

What does "async" mean in this test name? Can we just remove that word?

@@ -38,4 +39,23 @@ apiDescribe('Aggregation query', (persistence: boolean) => {
expect(snapshot.getCount()).to.equal(3);
});
});

it('getAggregateFromServerDirect fails if user is offline async', () => {
const testDocs = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we just use an empty collection here? I don't think it matters how many documents are present in the collection, and, if that is the case, then populating the collection somewhat implies that the contents of the collection are meaningful.

@dconeybe dconeybe removed their assignment Sep 7, 2022
@milaGGL milaGGL requested a review from dconeybe September 7, 2022 01:40
@milaGGL milaGGL merged commit 507e984 into mila/count Sep 7, 2022
@milaGGL milaGGL deleted the mila/count-offline-test branch September 7, 2022 05:07
@firebase firebase locked and limited conversation to collaborators Oct 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants