Open-EO / openeo-js-client

JavaScript and TypeScript client for the openEO API.
https://open-eo.github.io/openeo-js-client/latest/
Apache License 2.0
15 stars 6 forks source link

Tests missing #12

Closed christophfriedrich closed 5 years ago

christophfriedrich commented 5 years ago

I started a tests branch and already committed some tests (for very basic functionality, connecting, discovery and querying (empty) user data) in 167bd1126b38a2b9c7c0b55574bd047dfe6f987a, but Jest's coverage report doesn't look any good yet:


-----------|----------|----------|----------|----------|----------------|
 File      |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
-----------|----------|----------|----------|----------|----------------|
 openeo.js |    27.54 |    22.31 |    35.48 |    27.51 |... 730,734,735 |
-----------|----------|----------|----------|----------|----------------|
christophfriedrich commented 5 years ago

My tests rely on the earth-engine-driver instance deployed at http://giv-openeo.uni-muenster.de:8080/v0.3 - if the URL changes (which will happen in the coming week) or the server implementation changes (likely) or the data the server proxies changes (we've got no control over that), these tests may/will fail.

Also, I experienced it's a bit tricky to test all those asynchronous functions -- if you don't pay attention it can happen that a test that should fail PASSES because the test is evaluated before the failing function has returned.

christophfriedrich commented 5 years ago

A long day of work improves the coverage to at least:

-----------|----------|----------|----------|----------|----------------|
 File      |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
-----------|----------|----------|----------|----------|----------------|
 openeo.js |    59.79 |    45.39 |     73.6 |    59.12 |... 736,740,741 |
-----------|----------|----------|----------|----------|----------------|

Lesson learned today while working with async, Blobs and events at the same time: expect(...) can throw, so that the done() is never called!

m-mohr commented 5 years ago

I think this looks fine (node tests) and can be closed:

-----------|----------|----------|----------|----------|-------------------|
File       |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
-----------|----------|----------|----------|----------|-------------------|
All files  |    94.43 |    76.62 |    97.74 |    94.56 |                   |
 openeo.js |    94.43 |    76.62 |    97.74 |    94.56 |... 71,515,531,701 |
-----------|----------|----------|----------|----------|-------------------|