:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { buildIntegerMatcherWithPercentage } from './matchers'
describe('buildIntegerMatcherWithPercentage', () => {
it.each([
['', 123, false],
[undefined, 123, false],
['*', 123, true],
['*', 456, true],
['123,456', 123, true],
['123,456', 456, true],
['123,456', 789, false],
['*:1.0', 123, true],
['*:0', 123, false],
['123,*:0', 123, true],
['123,*:0', 456, false],
])('buildIntegerMatcherWithPercentage(%s)(%s) === %s', (config, id, expected) => {
expect(buildIntegerMatcherWithPercentage(config as string | undefined)(id as number)).toBe(expected)
})
})