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

Add guide on unit testing #6361

Merged
merged 5 commits into from Jun 5, 2020

Conversation

qunabu
Copy link
Contributor

@qunabu qunabu commented May 26, 2020

Description of what you did:

Improved version of #6324

Documentation update on unit testing based on my medium post https://medium.com/qunabu-interactive/strapi-jest-testing-with-gitlab-ci-82ffe4c5715a.

Sample repository to that includes the examples from the guide https://github.com/qunabu/strapi-unit-test-example

@qunabu qunabu mentioned this pull request May 26, 2020
@codecov
Copy link

codecov bot commented May 26, 2020

Codecov Report

Merging #6361 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #6361   +/-   ##
=======================================
  Coverage   19.87%   19.87%           
=======================================
  Files         856      856           
  Lines       12061    12061           
  Branches     1956     1956           
=======================================
  Hits         2397     2397           
  Misses       8085     8085           
  Partials     1579     1579           
Flag Coverage Δ
#front 14.67% <ø> (ø)
#unit 41.34% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3726433...4e69834. Read the comment docs.

Copy link
Contributor Author

@qunabu qunabu left a comment

Choose a reason for hiding this comment

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

Guide updated as well as my example

```

Those will inform `Jest` not to look for test inside the folder where it shouldn't.
::::
Copy link
Contributor

Choose a reason for hiding this comment

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

This end the tab.

But this should be used just after the npm command.

Few lines before.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed now

Copy link
Contributor Author

@qunabu qunabu left a comment

Choose a reason for hiding this comment

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

tab changes

docs/v3.x/guides/unit-testing.md Show resolved Hide resolved
docs/v3.x/guides/unit-testing.md Outdated Show resolved Hide resolved
@lauriejim lauriejim added source: docs Documentation changes issue: enhancement Issue suggesting an enhancement to an existing feature labels Jun 5, 2020
@lauriejim lauriejim changed the title guide on unit testing for v3.x Add guide on unit testing Jun 5, 2020
@lauriejim lauriejim added this to the 3.0.2 milestone Jun 5, 2020
Copy link
Contributor

@lauriejim lauriejim left a comment

Choose a reason for hiding this comment

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

LGTM, everything works fine

@lauriejim lauriejim merged commit 7ef2b89 into strapi:master Jun 5, 2020
@sa-ma
Copy link

sa-ma commented Jul 11, 2020

I'm a getting a 403 status when trying to test a Public endpoint

@VivianSolide
Copy link

I'm a getting a 403 status when trying to test a Public endpoint

@sa-ma : did you get rid off that?

@qunabu
Copy link
Contributor Author

qunabu commented Mar 1, 2021

@VivianSolide

I'm a getting a 403 status when trying to test a Public endpoint

@sa-ma : did you get rid off that?

Seems you're missing saving to db which routes are public. Tests are using different (empty) database.

I've written and post about this Allowing roles for test routes

@VivianSolide
Copy link

@VivianSolide

I'm a getting a 403 status when trying to test a Public endpoint

@sa-ma : did you get rid off that?

Seems you're missing saving to db which routes are public. Tests are using different (empty) database.

I've written and post about this Allowing roles for test routes

I stumbled upon your articles, very useful thanks @qunabu 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: enhancement Issue suggesting an enhancement to an existing feature source: docs Documentation changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants