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

Guide on unit testing #6324

Closed
wants to merge 21 commits into from
Closed

Conversation

qunabu
Copy link
Contributor

@qunabu qunabu commented May 22, 2020

Description of what you did:

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

adriatic and others added 17 commits April 6, 2020 12:00
Update tutorial files to use the Collection type instead of Content type

Signed-off-by: adriatic <nik@congral.com>
Signed-off-by: Jim LAURIE <j.laurie6993@gmail.com>
Update documentation from Content to Collection Type
Add rfcs into the contribution docs
Heroku Error: self-signed certificate SSL fix for PG '^8.0.0'. Setting SSL options to `"ssl": { "rejectUnauthorized": false }` enables SSL but does not reject self-signed certificate for Heroku deployment. The issue occurs when Heroku invokes node application but fails at SSL cert for PG ^8.0.0.

Signed-off-by: Kelvin Tsoi <ktsoi@wearfigs.com>
Signed-off-by: Derrick Mehaffy <derrickmehaffy@gmail.com>
Signed-off-by: Derrick Mehaffy <derrickmehaffy@gmail.com>
Signed-off-by: Jim LAURIE <j.laurie6993@gmail.com>
Signed-off-by: Derrick Mehaffy <derrickmehaffy@gmail.com>
Signed-off-by: Derrick Mehaffy <derrickmehaffy@gmail.com>
Signed-off-by: Derrick Mehaffy <derrickmehaffy@gmail.com>
Signed-off-by: Derrick Mehaffy <derrickmehaffy@gmail.com>
@codecov
Copy link

codecov bot commented May 22, 2020

Codecov Report

Merging #6324 into documentation will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@              Coverage Diff               @@
##           documentation    #6324   +/-   ##
==============================================
  Coverage          19.14%   19.14%           
==============================================
  Files                855      855           
  Lines              11933    11933           
  Branches            1898     1898           
==============================================
  Hits                2284     2284           
  Misses              8100     8100           
  Partials            1549     1549           
Flag Coverage Δ
#front 14.48% <ø> (ø)
#unit 39.93% <ø> (ø)

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 757aa70...757aa70. Read the comment docs.

@derrickmehaffy
Copy link
Member

Thank you for this guide! I've seen a number of users asking about this. 😃

lauriejim
lauriejim previously approved these changes May 24, 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.

Thank you so much for this guide, this is super useful!
LGTM!
Before merging it, I would like the approval from the tech team.
Ping @alexandrebodin for a tech review.

@qunabu
Copy link
Contributor Author

qunabu commented May 24, 2020

Code examples from the guide are here https://github.com/qunabu/strapi-unit-test-example is that helps.

@alexandrebodin
Copy link
Member

Hello @qunabu thank you for this guide. We are releasing the stable version soon and the configuration changed. Your PR will not be up to date with the stable release. Can you look at the latest doc on the master branch and update your PR accordingly ?

@qunabu qunabu changed the base branch from documentation to master May 25, 2020 13:44
@qunabu qunabu dismissed lauriejim’s stale review May 25, 2020 13:44

The base branch was changed.

@qunabu qunabu changed the base branch from master to documentation May 25, 2020 13:45
@qunabu qunabu changed the base branch from documentation to master May 25, 2020 13:57
@qunabu
Copy link
Contributor Author

qunabu commented May 25, 2020

Hello @qunabu thank you for this guide. We are releasing the stable version soon and the configuration changed. Your PR will not be up to date with the stable release. Can you look at the latest doc on the master branch and update your PR accordingly ?

Done

async function setupStrapi() {
if (!instance) {
/** the follwing code in copied from `./node_modules/strapi/lib/Strapi.js` */
await Strapi().load();
Copy link
Member

Choose a reason for hiding this comment

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

we made some changes to the load function, it now calls the bootstrap directly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@alexandrebodin - Which of https://www.npmjs.com/package/strapi versions I should use in my example (https://github.com/qunabu/strapi-unit-test-example/blob/master/package.json) in order to use up to date version?

I'm using latest 3.0.0-beta.20.3

Copy link
Member

Choose a reason for hiding this comment

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

You can use 3.0.0 :D

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@alexandrebodin I've updated my example code https://github.com/qunabu/strapi-unit-test-example

I'm going to update this as well, yet should this PR be into master or documentation branch?

@qunabu
Copy link
Contributor Author

qunabu commented May 26, 2020

#6361 that is the improved version

@qunabu qunabu closed this May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants