-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
test(server): incorrect prisma overriding #5857
Conversation
Hi @L-Sun, thanks for your contribution. It's my mistake. I previously made The problem is I didn't replace all |
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 98f7132. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 6 targets
Sent with 💌 from NxCloud. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## canary #5857 +/- ##
==========================================
+ Coverage 64.51% 64.72% +0.21%
==========================================
Files 360 358 -2
Lines 19956 19907 -49
Branches 1701 1697 -4
==========================================
+ Hits 12874 12885 +11
+ Misses 6863 6803 -60
Partials 219 219
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Merge activity
|
In some backend server tests,
overrideProvider(PrismaClient).useClass(FakePrisma)
dose not have effect.AFFiNE/packages/backend/server/tests/app.e2e.ts
Lines 49 to 59 in 67dffc2
AFFiNE/packages/backend/server/tests/mailer.spec.ts
Lines 129 to 143 in 67dffc2
the Injectable may only effect the
PrismaService
notPrismaClient
AFFiNE/packages/backend/server/src/fundamentals/prisma/service.ts
Lines 5 to 10 in 67dffc2
In
mailer.spec.ts
, however, it seem some methods are missing inFakePrisma
, which led to the test failing after fixing the override problem. So I keep this code unchanged.The test of mailer.spec.ts seems to only test the success of sending emails. I think there is no need to mock Prisma behavior. Just providing some fake data to the send function is good.
AFFiNE/packages/backend/server/tests/mailer.spec.ts
Lines 171 to 189 in 67dffc2