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

Tests in docker #191

Merged
merged 16 commits into from
Apr 5, 2023
Merged

Tests in docker #191

merged 16 commits into from
Apr 5, 2023

Conversation

osmannkartall
Copy link
Owner

@osmannkartall osmannkartall commented Apr 5, 2023

References:

Demonstration:

  1. Break one of the tests. Run docker build -t knowzone-server-test --target test . This should run the tests, give an error and not build the image.
  2. Fix all the tests and run the build command again. This should run the tests and build the image without error.
  3. Apply steps 1 and 2 for web/Docker file. Run the docker build -t knowzone-web-test --target test . command this time.
  4. docker-compose up -d uses prod stages in each Dockerfile. I didn't change anything.

closes #190

- We only create forms in FormCreator and PostCreator, so we don't need
  to declare separate useForm functions in Sidebar and Posts anymore.
- Since we already have posts in Posts.jsx, we don't need to use
  getValues to retrieve the id when deleting a post.
- If we don't wrap the FormCreator and PostCreator components in
  'isFormOpen &&', values of react-hook-forms in the Dialog components
  won't be cleared. We reset the forms by mounting/unmounting
  the dialog components.
- We refactored the PostCreator component by injecting the selected
  form. We moved the create post button to the posts/... routes, so we
  already have the required form after navigating to one of the
  posts/... paths.
  We also removed the setForm and formTypes props from PostCreator.
- We removed the dropdown for type in PostCreator since it wasn't
  useful or efficient.
- Since we don't use the type dropdown anymore, we don't need to
  validate the type field in postCreatorSchema.
- transform is required in jest.config.js
- We have to use .js extension in import
  statements for our scripts. This gives
  eslint warning. We added the "import/extensions"
  rule in .eslintrc.json to avoid it.
- --experimental-vm-modules flag is necessary
  to run jest with ecmascript modules.
@osmannkartall osmannkartall merged commit ef49f14 into master Apr 5, 2023
@osmannkartall osmannkartall deleted the tests-in-docker branch April 8, 2023 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

add test stages to dockerfiles
2 participants