Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
chore: Drop
adminClient
(1/2) #2356chore: Drop
adminClient
(1/2) #2356Changes from 8 commits
9246fec
3f96c63
27cfdf3
bda3ed1
5c545c0
6ed792a
255e645
4e54d39
7daacc5
6e7b88f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 71 in api.planx.uk/gis/digitalLand.ts
GitHub Actions / Run API Tests
Check warning on line 72 in api.planx.uk/gis/digitalLand.ts
GitHub Actions / Run API Tests
Check warning on line 106 in api.planx.uk/gis/digitalLand.ts
GitHub Actions / Run API Tests
Check warning on line 155 in api.planx.uk/gis/digitalLand.ts
GitHub Actions / Run API Tests
Check warning on line 199 in api.planx.uk/gis/digitalLand.ts
GitHub Actions / Run API Tests
Check warning on line 247 in api.planx.uk/gis/digitalLand.ts
GitHub Actions / Run API Tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's going on here?
CoreDomainClient
client is being mocked so that we can control and modify the behaviour offormatRawProjectTypes()
and test it.However, we want to retain the behaviour of
CoreDomainClient.client
so that real GraphQL queries get made so thatgraphql-query-test-mock
is able to catch and mock these calls. To do this we can usejest.requireActual
to maintain this behaviour.I feel like there's possibly a few more elegant options here - I'd like to revisit this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This structure is repeated a few times throughout this PR. I spent a good bit of time attempting to generalise it so that we could import it with an interface similar to -
Tried a few variations without much success - I suspect the problem is related to how Jest is hoisting mocks (through the
jest.mock("@opensystemslab/planx-core")
notation). I wanted to just move on as opposed to losing more time here so I'll open a GitHub issue describing this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue logged here - #2404