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

Feat/testing approaches #61

Merged
merged 6 commits into from
Nov 8, 2024
Merged

Feat/testing approaches #61

merged 6 commits into from
Nov 8, 2024

Conversation

G0maa
Copy link
Member

@G0maa G0maa commented Oct 19, 2024

  • E2E, Integration (kind of) & unit testing (also kind of).

Copy link

netlify bot commented Oct 19, 2024

Deploy Preview for disworse ready!

Name Link
🔨 Latest commit 59eca7b
🔍 Latest deploy log https://app.netlify.com/sites/disworse/deploys/672dd4314d48d70008805ff3
😎 Deploy Preview https://deploy-preview-61--disworse.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Comment on lines +36 to +47
session({
secret: configService.getOrThrow<string>("SESSION_SECRET"),
resave: false,
saveUninitialized: false,
cookie: {
maxAge: configService.getOrThrow<number>("COOKIE_MAX_AGE"),
httpOnly: true,
},
store: new RedisStore({
client: redisClient,
}),
}),

Check warning

Code scanning / CodeQL

Clear text transmission of sensitive cookie Medium test

Sensitive cookie sent without enforcing SSL encryption.

Copilot Autofix AI 9 days ago

To fix the problem, we need to ensure that the session cookie is only transmitted over HTTPS by setting the secure attribute to true. This can be done by modifying the cookie configuration within the session middleware setup. Specifically, we need to add the secure: true attribute to the cookie configuration object.

Suggested changeset 1
apps/api/test/TestManager.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/apps/api/test/TestManager.ts b/apps/api/test/TestManager.ts
--- a/apps/api/test/TestManager.ts
+++ b/apps/api/test/TestManager.ts
@@ -43,2 +43,3 @@
                     httpOnly: true,
+                    secure: true,
                 },
EOF
@@ -43,2 +43,3 @@
httpOnly: true,
secure: true,
},
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link

codecov bot commented Oct 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Files with missing lines Coverage Δ
apps/api/src/app.resolver.ts 90.47% <100.00%> (+0.47%) ⬆️
apps/api/src/app.service.ts 100.00% <100.00%> (+18.75%) ⬆️
apps/api/src/modules/users/entities/user.entity.ts 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

apps/api/schema.graphql Outdated Show resolved Hide resolved
Copy link
Contributor

@bassiounix bassiounix left a comment

Choose a reason for hiding this comment

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

Test coverage is low, not many functions are being tested.
Otherwise .. LGTM.

Copy link
Contributor

Choose a reason for hiding this comment

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

A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown. Try running with --detectOpenHandles to find leaks. Active timers can also cause this, ensure that .unref() was called on them.

appears when trying to run jest.

Also test:e2e shows a similar message:

Force exiting Jest: Have you considered using `--detectOpenHandles` to detect async operations that kept running after all tests finished?

Copy link
Member Author

@G0maa G0maa Oct 23, 2024

Choose a reason for hiding this comment

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

@bassiounix
The intention of this branch is not to test. The intention is to show developer working on Disworse HOW to test. With examples on Unit, E2E, and ((kind of)) integration tests.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also on the Jest error, I never managed to fix it, I usually silence it with --forceExit.

@G0maa G0maa merged commit 57ea70b into main Nov 8, 2024
9 checks passed
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.

2 participants