Tests / @ogygia/flags
@ogygia/flags
Version 0.14.0 latest
620ddcca 74 test runs (74 tests, each run in Node, the browsers or both)
1.06× lines of test for each line of source (1,119 to 1,060) 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)93.8% of source lines run by the tests
- 74Unit
- 0Browser
- 0End to end
- 0Type tests
- 0Lint rules
- 0Failing
Coverage
- 93.8%Lines
- 82.3%Branches
- 90.2%Functions
- 92.0%Statements
Every test
74 tests
| Test | Kind | Node | Chromium | Firefox | WebKit |
|---|---|---|---|---|---|
packages/flags/test/definitions-reload.test.ts | |||||
| flags defined by a module, across its dev reloads > a flag removed from the module is gone after its reload; a kept one stays | Unit | pass | not run | not run | not run |
| flags defined by a module, across its dev reloads > another module's reload keeps this module's flags | Unit | pass | not run | not run | not run |
packages/flags/test/exposure-queue.test.ts | |||||
| the exposure queue > a batch the sink failed is tried again before the batch read after it | Unit | pass | not run | not run | not run |
| the exposure queue > a sink that rejects is contained: no unhandled rejection, and a warning with its code | Unit | pass | not run | not run | not run |
| the exposure queue > an exposure read while a send is in flight goes in the next send, and that end waits for it | Unit | pass | not run | not run | not run |
| the exposure queue > nothing buffered: the end has nothing to wait for | Unit | pass | not run | not run | not run |
| the exposure queue > the age cap sends a buffered batch on its own | Unit | pass | not run | not run | not run |
| the exposure queue > the request's end resolves after the sink's send | Unit | pass | not run | not run | not 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() | Unit | pass | not run | not run | not run |
| decide + source — the OpenFeature seam (any resolver) > a source value that is a bigint is skipped, never read as off | Unit | pass | not run | not run | not run |
| decide + source — the OpenFeature seam (any resolver) > a source value that is a function is skipped, never read as off | Unit | pass | not run | not run | not run |
| decide + source — the OpenFeature seam (any resolver) > a source value that is a number is skipped, never read as off | Unit | pass | not run | not run | not run |
| decide + source — the OpenFeature seam (any resolver) > a source value that is a symbol is skipped, never read as off | Unit | pass | not run | not run | not run |
| decide + source — the OpenFeature seam (any resolver) > a source value that is another number is skipped, never read as off | Unit | pass | not run | not run | not run |
| decide + source — the OpenFeature seam (any resolver) > a source variant NOT in the declared set is ignored (falls through to native) | Unit | pass | not run | not run | not run |
| decide + source — the OpenFeature seam (any resolver) > a throwing source degrades every flag to native, never the request | Unit | pass | not run | not run | not run |
| decide + source — the OpenFeature seam (any resolver) > bare boolean/string source values are sugar for { variant } | Unit | pass | not run | not run | not run |
| decide + source — the OpenFeature seam (any resolver) > override still beats the source | Unit | pass | not run | not run | not run |
| decide + source — the OpenFeature seam (any resolver) > source decides a variant; validated against declared variants; primes once per request | Unit | pass | not run | not run | not run |
| decide + source — the source sees the visitor a read hashes on > an anonymous router visitor (anonymousVisitor()'s `{ vid }`) is read, and hashes like its cookie | Unit | pass | not run | not run | not run |
| decide + source — the source sees the visitor a read hashes on > anonymous → no visitor | Unit | pass | not run | not run | not run |
| decide + source — the source sees the visitor a read hashes on > anonymous carried claims (`{ vid }` from a shell) are read | Unit | pass | not run | not run | not run |
| decide + source — the source sees the visitor a read hashes on > carried claims win over the cookie; a router visitor wins over both | Unit | pass | not run | not run | not run |
| decide + source — the source sees the visitor a read hashes on > openfeature()'s default context gets the visitor as its targetingKey | Unit | pass | not run | not run | not run |
| decide + source — the source sees the visitor a read hashes on > the og-vid cookie (no router identity above the router) → `{ vid, anonymous }` | Unit | pass | not run | not run | not run |
| federation — decided flags auto-carry > a flag never read this request does NOT carry | Unit | pass | not run | not run | not run |
| federation — decided flags auto-carry > every flag decided this request self-registers its bucket for signed claims | Unit | pass | not run | not run | not run |
| flag — decision precedence > ?og-exp override beats everything (unknown variants ignored) | Unit | pass | not run | not run | not run |
| flag — decision precedence > carried claims (upstream shell) beat the native rule | Unit | pass | not run | not run | not run |
| flag — decision precedence > the override GATE: closed → ?og-exp is inert (prod default); reopened → honored | Unit | pass | not run | not run | not run |
| flag — layers (mutual exclusion, a string group) > a visitor lands in at most ONE member | Unit | pass | not run | not run | not run |
| flag — the four declaration shapes, read by calling > bare = a kill switch, off for everyone | Unit | pass | not run | not run | not run |
| flag — the four declaration shapes, read by calling > function = targeting; true → on, false → definitively off, undefined → fall through | Unit | pass | not run | not run | not run |
| flag — the four declaration shapes, read by calling > number = sticky rollout percent, ~accurate over a population | Unit | pass | not run | not run | not run |
| flag — the four declaration shapes, read by calling > record = weighted variants; anonymous → control (first key) | Unit | pass | not run | not run | not run |
| flag — the four declaration shapes, read by calling > weights are RATIOS, not percentages (3:1 ≈ 75/25) | Unit | pass | not run | not run | not run |
| flag.pick — one verb, two forms > boolean flag pick maps off/on | Unit | pass | not run | not run | not run |
| flag.pick — one verb, two forms > one-arg form = a page slot (ComponentPick), resolved per request, control fallback | Unit | pass | not run | not run | not run |
| flag.pick — one verb, two forms > stamp names the world for analytics | Unit | pass | not run | not run | not run |
| flag.pick — one verb, two forms > two-arg form = pick this visitor a value (numbers, strings, config) | Unit | pass | not run | not run | not run |
| flag.value — vendor payloads, schema-validated > an invalid vendor payload is rejected → fallback (trust boundary) | Unit | pass | not run | not run | not run |
| flag.value — vendor payloads, schema-validated > no source → fallback, never undefined | Unit | pass | not run | not run | not run |
| flag.value — vendor payloads, schema-validated > returns the validated payload, else the fallback | Unit | pass | not run | not run | not run |
packages/flags/test/hole-cache.test.ts | |||||
| a cached hole that reads a flag > answers a visitor who joins another bucket render in flight with their own variant | Unit | pass | not run | not run | not run |
| a cached hole that reads a flag > answers two visitors in two buckets with their own variants | Unit | pass | not run | not run | not run |
packages/flags/test/inventory-build.test.ts | |||||
| the flag inventory > a root the manifest cannot be written under never fails the build | Unit | pass | not run | not run | not run |
| the flag inventory > with flags() listed, a build writes every flag site, the unused module too | Unit | pass | not run | not run | not run |
| the flag inventory > without flags() there is no manifest, and the build says the plugin is not listed | Unit | pass | not run | not run | not run |
packages/flags/test/inventory.test.ts | |||||
| collect_flag_sites — AST binding resolution > a dynamic first argument is skipped (not inventoriable) | Unit | pass | not run | not run | not run |
| collect_flag_sites — AST binding resolution > a LOCAL function named `flag` is NOT counted (a text sweep would false-positive) | Unit | pass | not run | not run | not run |
| collect_flag_sites — AST binding resolution > a module that never imports ogygia yields nothing | Unit | pass | not run | not run | not run |
| collect_flag_sites — AST binding resolution > counts calls through named imports, with names and lines | Unit | pass | not run | not run | not run |
| collect_flag_sites — AST binding resolution > follows a NAMESPACE import (og.flag) | Unit | pass | not run | not run | not run |
| collect_flag_sites — AST binding resolution > follows a RENAMED import (a text sweep would miss this) | Unit | pass | not run | not run | not run |
| collect_flag_sites — AST binding resolution > svelte: a script tag in a markup comment or an attribute value is not a script | Unit | pass | not run | not run | not run |
| collect_flag_sites — AST binding resolution > svelte: flags inside <script> blocks carry FILE line numbers | Unit | pass | not run | not run | not run |
| flags_manifest > dedupes the two build legs and sorts stably | Unit | pass | not run | not run | not 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 assignment | Unit | pass | not run | not run | not run |
| flags() > is named by its package and names its server realm, the module beside it | Unit | pass | not run | not run | not run |
| the server realm > primes the source in `request`, done before the page reads a flag, and drains exposures in `done` | Unit | pass | not run | not run | not run |
| the server realm primes the source with the visitor > the event's og-vid cookie reaches the source as `c.visitor` | Unit | pass | not run | not run | not 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 answer | Unit | pass | not run | not run | not run |
| a source that throws before it awaits anything > leaves the request resolved (empty), never priming for good | Unit | pass | not run | not run | not run |
packages/flags/test/source-failed.test.ts | |||||
| a failing flag source is said > a request where one flag still fails does not end the streak, though the source answered the rest | Unit | pass | not run | not run | not run |
| a failing flag source is said > a source that never answers holds no request: past its deadline the flags fall to their native rule, and it is said | Unit | pass | not run | not run | not run |
| a failing flag source is said > a source that throws: said once for its failing streak, with the error, again after a request worked | Unit | pass | not run | not run | not run |
| a failing flag source is said > an OFREP endpoint that answers 500 | Unit | pass | not run | not run | not run |
| a failing flag source is said > an OFREP endpoint that cannot be reached | Unit | pass | not run | not run | not run |
| a failing flag source is said > an OpenFeature flag whose evaluation throws: said, and the other flags keep the source's answer | Unit | pass | not run | not run | not run |
packages/flags/test/sources.test.ts | |||||
| ofrep() > gives up after 800 ms by default | Unit | pass | not run | not run | not run |
| ofrep() > reads a boolean value as the on or off variant | Unit | pass | not run | not run | not run |
| ofrep() > stops asking when the request ends first, and reports no failure | Unit | pass | not run | not run | not run |
| ofrep() > throws on an error answer with a JSON body, so the flags fall to their native rule and it is said | Unit | pass | not run | not run | not run |
| openfeature() > asks with off as the default for a boolean flag and the first variant for a variant flag | Unit | pass | not run | not run | not run |