-
Notifications
You must be signed in to change notification settings - Fork 18
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
build: add js lib tests to ci #1577
Conversation
The |
This is a problem with precision in JavaScript (dasch-swiss/dsp-js-lib#126). Until this is fixed, the test data for "http://0.0.0.0:3333/ontology/0001/anything/v2#hasDecimal" should be something whose precision can be correctly represented without an additional lib. Maybe you can ask @benjamingeer to change the test data for now. |
So far, I have just fixed this manually in the test data. But because your tests generate everything automatically, this hack fails here. |
@benjamingeer @subotic I think all that has to be done to make this PR work is changing the test value for |
@tobiasschweizer That request is also used to test Knora. I thought that was the whole idea here: we use the same request to test Knora and to test the client code. If we change it to 1.5, we're not testing Knora's handling of decimal precision. |
I understand. So should we patch the test data after its generation until dasch-swiss/dsp-js-lib#126 is done?
I think I could write a script that could be called from |
@tobiasschweizer How about just disabling that test until dasch-swiss/dsp-js-lib#126 is done? |
The problem is that this affects the test for resource creation: https://github.com/dasch-swiss/knora-api-js-lib/blob/da6f34514f33e64d1734ae9d2d37c21f958be2af/src/api/v2/resource/resources-endpoint.spec.ts#L111-L245 It's not a test that is specific to decimal values. |
OK, but it seems to me that if you can't create a resource with a decimal value, you can't create a resource, so that test should fail or be disabled. |
Let's say that I give it a try and if it takes too much time to write the script, I will think you disabling the test. |
You absolutely can. The problem is just that precision is lost in JS with the given decimal number. |
But that's a bug. If there's a bug, then I think the test should fail or be disabled. |
It's the way JS can handle precision without any additional libraries or workarounds. |
I could imagine various ways of dealing with this in JS, including using a string rather than a number. But from the user's point of view, that's irrelevant. If the resource creation test passes, the user should be able to trust that they can create a resource with any value type and get the expected result. If that's not true, the test should fail. |
@benjamingeer thanks for the review :-) I will merge this. Whatever else needs to be done, can then be done in a different PR. |
knora-api
, because the dependency is the other way around. The reviewer, before approving a PR, needs to make sure, that a PR is in place and ready for merging inknora-api-js-lib
.--
resolves Generate client code and run Tests in knora-api-js-lib automatically #1554
resolves Change CI to use private repository instead of encrypted files #1599