Skip to content

test(Common): cover isOverrideApplicable and getOverrideMeta in UserOverrideUtil#2581

Open
suvvvv wants to merge 1 commit into
OneUptime:masterfrom
suvvvv:test/user-override-util
Open

test(Common): cover isOverrideApplicable and getOverrideMeta in UserOverrideUtil#2581
suvvvv wants to merge 1 commit into
OneUptime:masterfrom
suvvvv:test/user-override-util

Conversation

@suvvvv

@suvvvv suvvvv commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

What

The existing UserOverrideUtil suite exercises applyOverridesToEvents thoroughly, but never calls isOverrideApplicable or getOverrideMeta directly. This adds focused coverage for those two public methods, on top of the existing tests.

  • isOverrideApplicable — global overrides (no policy id) always apply; policy-scoped overrides apply only to their own policy, and never without a policy context.
  • getOverrideMetanull for a plain event, the meta for a segment produced by a substitution (asserting originalUserId / overrideUserId), and null when the marker is present but isOverride isn't true.

Note

This PR originally added a separate test file, which collided with the suite added on master in the meantime. It has been rebased onto master and reduced to purely additive tests — the existing 10 tests are untouched, and only the two previously-uncovered public methods are added.

Testing

node node_modules/.bin/jest --runInBand ./Tests/Types/OnCallDutyPolicy/UserOverrideUtil.test.ts

16 tests pass (10 existing + 6 new). Prettier- and eslint-clean.

@simlarsen

simlarsen commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

The existing UserOverrideUtil suite exercises applyOverridesToEvents
thoroughly but never calls isOverrideApplicable or getOverrideMeta
directly. Add focused coverage for those two public methods:

- isOverrideApplicable: global overrides (no policy id) always apply;
  policy-scoped overrides apply only to their own policy and never
  without a policy context.
- getOverrideMeta: null for a plain event, the meta for a segment
  produced by a substitution, and null when the marker is present but
  isOverride is not true.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@suvvvv suvvvv force-pushed the test/user-override-util branch from 7fa23db to 5812980 Compare July 14, 2026 10:05
@suvvvv suvvvv changed the title test(Common): add tests for Types/OnCallDutyPolicy/UserOverrideUtil test(Common): cover isOverrideApplicable and getOverrideMeta in UserOverrideUtil Jul 14, 2026
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