balena-io-modules / pinejs-client-js

4 stars 4 forks source link

Export the transformGetResult helper, to help consumers override the get method #97

Closed thgreasi closed 4 years ago

thgreasi commented 4 years ago

Change-type: minor See: https://github.com/balena-io/balena-api/pull/2532

CameronDiver commented 4 years ago

Happy with the impl @thgreasi but what is the reasoning for consumers overriding the get method?

thgreasi commented 4 years ago

@CameronDiver @Page- I actually had to copy over this method as part of the PineTest helper (which uses supertest as the request client) and I had to override the .get() method in order to replace the .then call that's in there with a .expect, in order to still allow using chaining more .expect after the .get() call. See: https://github.com/balena-io/balena-api/pull/2532/files#diff-0a71856e9e1f50c4d98abf95a0f92e3bR26

I do agree though that this isn't a pretty usual use case, so I don't have a strong opinion about whether we should really export the transformGetResult helper (or alternatively expose it as a method of the class). @Page- Let me know what you think and or feel free to close this if you prefer.