Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

HARP-12868: Fix Tile and TileGeometryLoader tests #1963

Merged
merged 4 commits into from
Nov 11, 2020

Conversation

atomicsulfate
Copy link
Collaborator

Thank you for contributing to harp.gl!

Before requesting a pull request, please remember to check the following documents:

If you are adding new functionality we would highly appreciate if you can describe what is the capability you are adding and even better if you can add some examples. Please also remember to add tests for it.

CI Check

Our bots will check whether your PR can be directly integrated into the mainline. We have some internal integration tests running on the background, our bots will inform you of the next steps and someone from our team will take a look and help if needed!

And please do not forget to sign-off your commit! You can read more about DCO here. But, in short, you just need to use git commit -s or append --signoff when you are committing to the repo.

Happy contributing!

@codecov
Copy link

codecov bot commented Nov 10, 2020

Codecov Report

Merging #1963 (baf0547) into master (99f5028) will decrease coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1963      +/-   ##
==========================================
- Coverage   65.94%   65.94%   -0.01%     
==========================================
  Files         293      293              
  Lines       26224    26224              
  Branches     5923     5923              
==========================================
- Hits        17294    17293       -1     
- Misses       8930     8931       +1     
Impacted Files Coverage Δ
@here/harp-utils/lib/Logger/ConsoleChannel.ts 69.23% <0.00%> (-15.39%) ⬇️
@here/harp-mapview/lib/MapView.ts 72.74% <0.00%> (-0.25%) ⬇️
@here/harp-utils/lib/Logger/LoggerManagerImpl.ts 80.85% <0.00%> (+8.51%) ⬆️

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 99f5028...baf0547. Read the comment docs.

expect(spyCreateGeometries.callCount).equal(1);
expect(geometryLoader.isFinished).to.be.true;
});
geometryLoader.waitFinished().should.be.fulfilled;
Copy link
Member

Choose a reason for hiding this comment

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

should await

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

will do

@@ -230,14 +224,14 @@ describe("TileGeometryLoader", function() {

expect(mapView.taskQueue.processNext(TileTaskGroups.CREATE)).equal(true);

geometryLoader.waitFinished().should.be.rejected.then(() => {
return geometryLoader.waitFinished().should.be.rejected.then(() => {
Copy link
Member

Choose a reason for hiding this comment

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

this file mixes returning a promise & async / await, please choose one way and keep it consistent

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

will do

expect(mapView.taskQueue.numItemsLeft(TileTaskGroups.CREATE)).equal(1);
expect(mapView.taskQueue.processNext(TileTaskGroups.CREATE)).equal(true);
expect(spyProcessTechniques.callCount).equal(1);
expect(spyCreateGeometries.callCount).equal(0, "should not create geometry");
Copy link
Member

Choose a reason for hiding this comment

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

I debugged this and they are incremented after the geometryLoader!.update(); call, so they should be put up there.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

will do

@@ -22,6 +23,20 @@ describe("WebTileDataSource", function() {
projection: mercatorProjection
} as MapView;

let loggerWasEnabled = true;
Copy link
Member

Choose a reason for hiding this comment

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

this is quite a bit of code to remove the error logging, can it be done in a different way?

Also, it seems that at least in the WebTileTest.ts there is only a single test which causes this. So I think it makes sense to put this code just there.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Moved to the test in question. I don't know how to simplify it, let me know if you think of something.

We have to leave the logging system in its original state after the affected state to avoid affecting other tests. We have some tests that even capture logs and make assertions on them (quite nasty if you ask me).

@atomicsulfate atomicsulfate merged commit 40a856b into master Nov 11, 2020
@atomicsulfate atomicsulfate deleted the HARP-12868_FixTileTests branch November 11, 2020 09:46
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