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

Refactor worker/entity tests #1009

Closed
ktuite opened this issue Sep 27, 2023 · 1 comment
Closed

Refactor worker/entity tests #1009

ktuite opened this issue Sep 27, 2023 · 1 comment
Assignees
Labels
entities Multiple Encounter workflows refactor Improves code without altering behavior testing Integration tests, unit tests

Comments

@ktuite
Copy link
Member

ktuite commented Sep 27, 2023

Addressed in PR #1021

There are a number of tests in tests/integration/worker/entity.js that were made before we had more of the API in place that we might be able to remove. This file could be made to focus just on the entity worker?

I find myself either forgetting about this file, or over-relying on this file as a kind of catch-all of entity workflow test scenarios. For example, I'm writing entity update tests here because I'm not sure where else they should go... in the GET entities/uuid endpoint? Sometimes I want to test one scenario, like entity updates, and maybe check that multiple endpoints look as expected instead of duplicating the scenario across the tests for different endpoints.

Do other people have issues with not knowing where to put tests? Suggestions?

@github-project-automation github-project-automation bot moved this to 🕒 backlog in ODK Central Sep 27, 2023
@ktuite ktuite added refactor Improves code without altering behavior entities Multiple Encounter workflows labels Sep 27, 2023
@matthew-white
Copy link
Member

For getodk/central#385, existing tests of the form worker were in test/integration/api/forms/forms.js and test/integration/api/forms/draft.js. I think that's because the worker is triggered by the endpoints to create a form or draft or to publish a draft. By that logic though, we should test the entity worker in the tests of the submission creation endpoints, and that doesn't feel right. 🤔 I feel like there are multiple reasonable options here. If this feels like a special case since it touches so many endpoints and is about a larger workflow, one option might be that we move these tests to their own file or set of files.

@matthew-white matthew-white added the testing Integration tests, unit tests label Sep 28, 2023
@ktuite ktuite self-assigned this Oct 5, 2023
@ktuite ktuite moved this from 🕒 backlog to ✏️ in progress in ODK Central Oct 9, 2023
@ktuite ktuite moved this from ✏️ in progress to ✅ done in ODK Central Oct 10, 2023
@ktuite ktuite closed this as completed Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
entities Multiple Encounter workflows refactor Improves code without altering behavior testing Integration tests, unit tests
Projects
Status: ✅ done
Development

No branches or pull requests

2 participants