Skip to content
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

feat: rename MockProvider to CustomProvider and expose it #8

Merged
merged 4 commits into from
Apr 15, 2019

Conversation

varl
Copy link
Contributor

@varl varl commented Apr 12, 2019

Alternative to #7.

Not sure if I prefer StaticDataProvider or OfflineDataProvider. Looking at the code I think Static makes more sense, as I was doing the change Offline made me think that it insinuates to be used with e.g. local storage.

@varl varl requested a review from amcgee April 12, 2019 13:00
@amcgee
Copy link
Member

amcgee commented Apr 14, 2019

I think I prefer Static to Offline as well, though since it supports functional request resolvers it's not exactly either (you could make a custom resolver which fetches from a server, technically). Maybe we want the name to imply the intended use though, in which case I think static is fine. CustomDataProvider or ManualDataProvider are other options.

@amcgee
Copy link
Member

amcgee commented Apr 14, 2019

Definitely prefer this over #7 though, nice!

@varl varl changed the title feat: rename mock prodiver to offline provider and expose it feat: rename mock provider to offline provider and expose it Apr 14, 2019
@varl
Copy link
Contributor Author

varl commented Apr 14, 2019

Prodiver 🤣

@varl
Copy link
Contributor Author

varl commented Apr 15, 2019

I think I prefer CustomDataProvider.

@varl
Copy link
Contributor Author

varl commented Apr 15, 2019

There's some TS syntax (I think?) that's problematic for the code style:

[ERROR] Formatting failed. services/data/src/context/makeCustomContext.test.js

{ SyntaxError: Unexpected token, expected "," (48:24)
  46 |     it('Should throw if custom data is something crazy like a bigint', async () => {
  47 |         const customData = {
> 48 |             test: null as any,
     |                        ^

Everything passes, it just fails to format this one file.

@varl
Copy link
Contributor Author

varl commented Apr 15, 2019

Renamed to Custom.

@amcgee
Copy link
Member

amcgee commented Apr 15, 2019

Everything passes, it just fails to format this one file.

Yeah that's TS syntax. I had to do something a tiny bit nasty to test the should-be-impossible case (otherwise TS prevents passing invalid data). Will take a look quickly today.

@varl
Copy link
Contributor Author

varl commented Apr 15, 2019

Everything passes, it just fails to format this one file.

Yeah that's TS syntax. I had to do something a tiny bit nasty to test the should-be-impossible case (otherwise TS prevents passing invalid data). Will take a look quickly today.

So that case is impossible if one uses TS to consume the library, but for a consumer built in JS it might trigger the impossible case?

@amcgee
Copy link
Member

amcgee commented Apr 15, 2019

Everything passes, it just fails to format this one file.

Yeah that's TS syntax. I had to do something a tiny bit nasty to test the should-be-impossible case (otherwise TS prevents passing invalid data). Will take a look quickly today.

So that case is impossible if one uses TS to consume the library, but for a consumer built in JS it might trigger the impossible case?

Believe so. I'll look into making the test file .js instead

@varl
Copy link
Contributor Author

varl commented Apr 15, 2019

@amcgee OK, good to know. Either way it's like this on master too, so up to you if you want to do it on this branch or a new one.

Copy link
Member

@amcgee amcgee left a comment

Choose a reason for hiding this comment

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

@varl so the issue was actually that the test file was .js, not .ts so the formatting failed when it saw typescript syntax. I changed it to .ts and everything works. I also made a tiny update to the helper function name (resolveCustom => resolveCustomResource).

LGTM, thanks for putting it together, merging!

@amcgee amcgee changed the title feat: rename mock provider to offline provider and expose it feat: rename MockProvider to CustomProvider and expose it Apr 15, 2019
@amcgee amcgee merged commit 2411fbc into master Apr 15, 2019
@amcgee amcgee deleted the refactor/offline-provider branch April 15, 2019 12:13
@varl
Copy link
Contributor Author

varl commented Apr 15, 2019

@amcgee oh, nice!

dhis2-bot pushed a commit that referenced this pull request Apr 15, 2019
# [1.1.0](v1.0.0...v1.1.0) (2019-04-15)

### Features

* rename MockProvider to CustomProvider and expose it ([#8](#8)) ([2411fbc](2411fbc))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants