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

Fixing assert tests #168

Merged
merged 4 commits into from
May 16, 2024
Merged

Fixing assert tests #168

merged 4 commits into from
May 16, 2024

Conversation

danjoa
Copy link
Contributor

@danjoa danjoa commented May 7, 2024

Please always follow our own recommendations for tests:

When checking expected errors messages, only check for significant keywords. Don't hardwire the exact error text, as this might change over time, breaking your test unnecessarily.

DON'T hardwire on overly specific error messages:

await expect(POST(`/catalog/Books`,...)).to.be.rejectedWith(
  'Entity "CatalogService.Books" is readonly'
)

DO check for the essential information only:

await expect(POST(`/catalog/Books`,...)).to.be.rejectedWith(
  /readonly/i
)

@danjoa danjoa requested review from sjvans and johannes-vogel May 7, 2024 10:53
@danjoa danjoa requested a review from a team as a code owner May 7, 2024 10:53
@danjoa danjoa enabled auto-merge May 13, 2024 14:23
@@ -1,3 +1,5 @@
process.env.cds_features_cds__assert ??= 'lean'
Copy link
Contributor

@johannes-vogel johannes-vogel May 14, 2024

Choose a reason for hiding this comment

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

is it required to set the env variable?
I'd prefer to omit that if possible

@danjoa danjoa merged commit f541333 into main May 16, 2024
3 checks passed
@danjoa danjoa deleted the fix-asserts branch May 16, 2024 09:21
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