d0523fcc2d
- P0: CLI verify now honors test budget with seeded multi-sample - P0: Observe sampling enforced via Math.random() gate in hook-validator - P1: Remove misleading undici-mock-agent isolation option - P1: Qualify reuses shared discoverRouteDetails() with warnings - P1: Chaos/scenario config exposed via preset schema - P1: README/docs limitations updated to current state - P2: Nested response annotations prefer 2xx deterministically - P2: --changed documented as heuristic in verify.md - Add observe sink tests (sampling 0/1, sink failure non-interference) - Add verify runs regression tests (scale, determinism, variants) - Add configured-scenario qualify test (independent of OAuth fixture) - Add coverageBreakdown to qualify artifacts (per-gate route coverage) - Add production-style observe example with real sink in docs/observe.md - Add nightly/staging vs PR gating guidance to docs/qualify.md - Enrich VerifyFailure with formula-aware diagnostics: status:201 => 'HTTP 200', body field checks => actual values - Remove stale observe CLI activation message - Document outbound mocks as process-global in getting-started.md - Refresh APOPHIS_ADOPTION_AUDIT.md with current state 903 tests pass, build clean, typecheck clean.
23 lines
791 B
TypeScript
23 lines
791 B
TypeScript
function escapeRegex(str: string): string {
|
|
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
}
|
|
|
|
export function matchesTarget(url: string, target: string): boolean {
|
|
if (target === url) return true
|
|
if (target.includes('*')) {
|
|
const escaped = escapeRegex(target)
|
|
const regex = new RegExp('^' + escaped.replace(/\\\*/g, '.*') + '$')
|
|
return regex.test(url)
|
|
}
|
|
return url.includes(target)
|
|
}
|
|
|
|
export function matchesWildcardPattern(value: string, pattern: string): boolean {
|
|
if (!pattern.includes('*') && !pattern.includes('?')) {
|
|
return value.toLowerCase() === pattern.toLowerCase()
|
|
}
|
|
const escaped = escapeRegex(pattern)
|
|
const regexPattern = '^' + escaped.replace(/\\\*/g, '.*').replace(/\\\?/g, '.') + '$'
|
|
return new RegExp(regexPattern, 'i').test(value)
|
|
}
|