Tests / @ogygia/flags

@ogygia/flags

Version 0.13.1
commit 4b18f465
44 test runs (44 tests, each run in Node, the browsers or both)
0.79× lines of test for each line of source (655 to 825) Only real test code counts: test files and their helpers, not fixtures, sample apps or benches. Blank lines are left out on both sides.
Exactly what is counted non-blank lines of test code across the repo (*.test.ts, *.test-d.ts, *.spec.ts, and the .ts helpers in test/ and e2e/ folders; no fixtures, fixture apps, stubs or benches), over non-blank lines of packages/*/src (no .d.ts or generated files)
88.0% of source lines run by the tests
  • 44Unit
  • 0Browser
  • 0End to end
  • 0Type tests
  • 0Lint rules
  • 0Failing

Coverage

  • 88.0%Lines
  • 74.7%Branches
  • 86.4%Functions
  • 87.4%Statements

Every test

End-to-end suites are not part of this report yet.

44 tests

TestKindNodeChromiumFirefoxWebKit
packages/flags/test/exposure-queue.test.ts
the exposure queue > a batch the sink failed is tried again before the batch read after itUnitpassnot runnot runnot run
the exposure queue > a sink that rejects is contained: no unhandled rejection, and a warning with its codeUnitpassnot runnot runnot run
the exposure queue > an exposure read while a send is in flight goes in the next send, and that end waits for itUnitpassnot runnot runnot run
the exposure queue > nothing buffered: the end has nothing to wait forUnitpassnot runnot runnot run
the exposure queue > the age cap sends a buffered batch on its ownUnitpassnot runnot runnot run
the exposure queue > the request's end resolves after the sink's sendUnitpassnot runnot runnot run
packages/flags/test/flags.test.ts
decide — exposure batching > fires once per (request, flag); flushes at max, at the timer, and at flush_exposures()Unitpassnot runnot runnot run
decide + source — the OpenFeature seam (any resolver) > a source variant NOT in the declared set is ignored (falls through to native)Unitpassnot runnot runnot run
decide + source — the OpenFeature seam (any resolver) > a throwing source degrades every flag to native, never the requestUnitpassnot runnot runnot run
decide + source — the OpenFeature seam (any resolver) > bare boolean/string source values are sugar for { variant }Unitpassnot runnot runnot run
decide + source — the OpenFeature seam (any resolver) > override still beats the sourceUnitpassnot runnot runnot run
decide + source — the OpenFeature seam (any resolver) > source decides a variant; validated against declared variants; primes once per requestUnitpassnot runnot runnot run
decide + source — the source sees the visitor a read hashes on > anonymous → no visitorUnitpassnot runnot runnot run
decide + source — the source sees the visitor a read hashes on > carried claims win over the cookie; a router visitor wins over bothUnitpassnot runnot runnot run
decide + source — the source sees the visitor a read hashes on > openfeature()'s default context gets the visitor as its targetingKeyUnitpassnot runnot runnot run
decide + source — the source sees the visitor a read hashes on > the og-vid cookie (no router identity above the router) → `{ sub, anonymous }`Unitpassnot runnot runnot run
federation — decided flags auto-carry > a flag never read this request does NOT carryUnitpassnot runnot runnot run
federation — decided flags auto-carry > every flag decided this request self-registers its bucket for signed claimsUnitpassnot runnot runnot run
flag — decision precedence > ?og-exp override beats everything (unknown variants ignored)Unitpassnot runnot runnot run
flag — decision precedence > carried claims (upstream shell) beat the native ruleUnitpassnot runnot runnot run
flag — decision precedence > the override GATE: closed → ?og-exp is inert (prod default); reopened → honoredUnitpassnot runnot runnot run
flag — layers (mutual exclusion, a string group) > a visitor lands in at most ONE memberUnitpassnot runnot runnot run
flag — the four declaration shapes, read by calling > bare = a kill switch, off for everyoneUnitpassnot runnot runnot run
flag — the four declaration shapes, read by calling > function = targeting; true → on, false → definitively off, undefined → fall throughUnitpassnot runnot runnot run
flag — the four declaration shapes, read by calling > number = sticky rollout percent, ~accurate over a populationUnitpassnot runnot runnot run
flag — the four declaration shapes, read by calling > record = weighted variants; anonymous → control (first key)Unitpassnot runnot runnot run
flag — the four declaration shapes, read by calling > weights are RATIOS, not percentages (3:1 ≈ 75/25)Unitpassnot runnot runnot run
flag.pick — one verb, two forms > boolean flag pick maps off/onUnitpassnot runnot runnot run
flag.pick — one verb, two forms > one-arg form = a page slot (ComponentPick), resolved per request, control fallbackUnitpassnot runnot runnot run
flag.pick — one verb, two forms > stamp names the world for analyticsUnitpassnot runnot runnot run
flag.pick — one verb, two forms > two-arg form = pick this visitor a value (numbers, strings, config)Unitpassnot runnot runnot run
flag.value — vendor payloads, schema-validated > an invalid vendor payload is rejected → fallback (trust boundary)Unitpassnot runnot runnot run
flag.value — vendor payloads, schema-validated > no source → fallback, never undefinedUnitpassnot runnot runnot run
flag.value — vendor payloads, schema-validated > returns the validated payload, else the fallbackUnitpassnot runnot runnot run
packages/flags/test/plugin.test.ts
facts a read reports > a read is a per-visitor read (a stored page never keeps one variant) and an assignmentUnitpassnot runnot runnot run
flags() > is named by its package and names its server realm, the module beside itUnitpassnot runnot runnot run
the server realm > primes the source in `request` and drains exposures in `done`Unitpassnot runnot runnot run
the server realm primes the source with the visitor > the event's og-vid cookie reaches the source as `c.visitor`Unitpassnot runnot runnot run
packages/flags/test/prime-twice.test.ts
a second prime of a request while the first waits > returns once the source answered, and reads get its answerUnitpassnot runnot runnot run
a source that throws before it awaits anything > leaves the request resolved (empty), never priming for goodUnitpassnot runnot runnot run
packages/flags/test/source-failed.test.ts
a failing flag source is said > a source that throws: said once for its failing streak, with the error, again after a request workedUnitpassnot runnot runnot run
a failing flag source is said > an OFREP endpoint that answers 500Unitpassnot runnot runnot run
a failing flag source is said > an OFREP endpoint that cannot be reachedUnitpassnot runnot runnot run
a failing flag source is said > an OpenFeature flag whose evaluation throws: said, and the other flags keep the source's answerUnitpassnot runnot runnot run