Skip to content

test(amber): unit tests for web/resource pure-logic helpers#5219

Open
Yicong-Huang wants to merge 1 commit into
apache:mainfrom
Yicong-Huang:test/web-resource-pure-logic
Open

test(amber): unit tests for web/resource pure-logic helpers#5219
Yicong-Huang wants to merge 1 commit into
apache:mainfrom
Yicong-Huang:test/web-resource-pure-logic

Conversation

@Yicong-Huang
Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Add six ScalaTest specs covering a self-contained cluster of pure-logic helpers under amber/src/main/scala/org/apache/texera/web/resource/ that ship without direct unit coverage.

  • EmailTemplateSpec — admin / user branches of userRegistrationNotification, optional-field fallbacks, role-change template per UserRoleEnum.
  • FulltextSearchQueryUtilsSpec — pgroonga and fallback to_tsvector predicates, getContainsFilter OR + set dedup, getDateFilter open-ended endpoints + end-of-day bump + ParseException, getOperatorsFilter case-insensitive LIKE.
  • EntityTablesSpec and EntityTypeSpec — hub dispatch tables for Workflow and Dataset, CloneTable's asymmetric IAE on Dataset, Jackson @JsonValue / @JsonCreator round-trip.
  • HealthCheckResourceSpec and SuccessExecutionResultSpec — the trivial contracts that deployment manifests and the frontend success-handler rely on.

Pins one quirky edge case in FulltextSearchQueryUtils.getFullTextSearchFilter: keywords.filter(_.nonEmpty) is applied before map(_.trim), so a whitespace-only keyword survives and produces a degenerate pgroonga_condition('', ...) predicate. A future fix (move the trim into the filter step) would break that pinned test deliberately.

Any related issues, documentation, discussions?

Closes #5217.

How was this PR tested?

Added unit tests under amber/src/test/scala/org/apache/texera/web/resource/.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Opus 4.7

Covers a self-contained cluster of pure-logic helpers under
org.apache.texera.web.resource that ship without direct unit coverage:
EmailTemplate (admin/user registration branches + role change),
FulltextSearchQueryUtils (pgroonga and fallback search predicates,
contains / date / operators filters), EntityTables + EntityType
(hub dispatch and Jackson round-trip), HealthCheckResource, and
SuccessExecutionResult. Pins one whitespace-only-keyword edge case
in FulltextSearchQueryUtils whose filter-before-trim ordering produces
a degenerate empty-string pgroonga predicate; a future tightening
should break that pinned test deliberately.
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.79%. Comparing base (24f7702) to head (6e5dac1).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5219      +/-   ##
============================================
+ Coverage     48.55%   48.79%   +0.24%     
- Complexity     2372     2378       +6     
============================================
  Files          1042     1042              
  Lines         39971    39971              
  Branches       4252     4252              
============================================
+ Hits          19408    19504      +96     
+ Misses        19414    19317      -97     
- Partials       1149     1150       +1     
Flag Coverage Δ *Carryforward flag
access-control-service 39.53% <ø> (ø) Carriedforward from 24f7702
agent-service 33.76% <ø> (ø) Carriedforward from 24f7702
amber 52.15% <ø> (+0.63%) ⬆️
computing-unit-managing-service 0.00% <ø> (ø) Carriedforward from 24f7702
config-service 0.00% <ø> (ø) Carriedforward from 24f7702
file-service 37.99% <ø> (ø) Carriedforward from 24f7702
frontend 40.02% <ø> (ø) Carriedforward from 24f7702
python 90.51% <ø> (ø) Carriedforward from 24f7702
workflow-compiling-service 56.81% <ø> (ø) Carriedforward from 24f7702

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add unit tests for org.apache.texera.web.resource pure-logic helpers

2 participants