SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
import { getQueryString } from './helper';
describe('getQueryString', () => {
it('returns an array of query strings for given available parameters and URLSearchParams', () => {
const availableParams = ['param1', 'param2', 'param3'];
const params = new URLSearchParams(
'param1=value1¶m2=value2¶m4=value4',
);
const result = getQueryString(availableParams, params);
expect(result).toStrictEqual(['param1=value1', 'param2=value2', '']);
});
it('returns an array of empty strings if no matching parameters are found', () => {
const availableParams = ['param1', 'param2', 'param3'];
const params = new URLSearchParams('param4=value4¶m5=value5');
const result = getQueryString(availableParams, params);
expect(result).toStrictEqual(['', '', '']);
});
it('returns an empty array if the available parameters list is empty', () => {
const availableParams: string[] = [];
const params = new URLSearchParams(
'param1=value1¶m2=value2¶m3=value3',
);
const result = getQueryString(availableParams, params);
expect(result).toStrictEqual([]);
});
});