Skip to content

Fix push controller tests. #3853

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 1 commit into from
May 24, 2017
Merged

Fix push controller tests. #3853

merged 1 commit into from
May 24, 2017

Conversation

aontas
Copy link
Contributor

@aontas aontas commented May 23, 2017

A whole bunch of the PushController tests never actually tested to ensure that they actually did what they thought they did. In some cases, no pushes were ever sent at all.

For example the following query will never actually push to anything:

{
  'deviceToken': {
    '$inQuery': {
      'where': { 'deviceType': 'ios' },
      className: '_Installation'
    }
  }
}

Why? Because the result of the $inQuery is an array of _Installation object pointers and no deviceToken is an installation object.

Previously, the only thing that was actually testing was that no crash happened when passing in a query that would return no results.

@codecov
Copy link

codecov bot commented May 23, 2017

Codecov Report

Merging #3853 into master will decrease coverage by 0.07%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3853      +/-   ##
==========================================
- Coverage   90.25%   90.17%   -0.08%     
==========================================
  Files         114      114              
  Lines        7550     7550              
==========================================
- Hits         6814     6808       -6     
- Misses        736      742       +6
Impacted Files Coverage Δ
src/Adapters/Cache/InMemoryCache.js 92.3% <0%> (-7.7%) ⬇️
...rc/Adapters/Storage/Mongo/MongoSchemaCollection.js 94.44% <0%> (-2.78%) ⬇️
src/StatusHandler.js 99.05% <0%> (-0.95%) ⬇️
...dapters/Storage/Postgres/PostgresStorageAdapter.js 95.46% <0%> (-0.14%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 67a1da8...2788231. Read the comment docs.

@aontas
Copy link
Contributor Author

aontas commented May 23, 2017

I guess this reduces coverage as there is no longer a test that does nothing?

@flovilmart
Copy link
Contributor

@aontas the codecov is sometimes weird, we have that from times to times, I suspect it's because of babel etc...

expect(installation.get('badge')).toBe(1);
}
done()
}).catch((err) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

not asking you to change, just an fyi, this can be written nice and tersely:

.catch(done.fail);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool, thanks!

@flovilmart flovilmart merged commit 1f11ad5 into parse-community:master May 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants