import { ParserBuilder } from "./parsers-gDSkX8OH.js"; //#region src/testing.d.ts /** * Test that a parser is bijective (serialize then parse gives back the same value). * * It will throw if the parser does not serialize the input to the expected serialized value, * or if the parser does not parse the serialized value to the expected input value. * The parser's `eq` function (if provided, otherwise `===`) is used to compare the values. * * Usage: * ```ts * // Expect it to pass (no error thrown) * expect(isParserBijective(parseAsInteger, '42', 42)).toBe(true) * // Expect it to fail * expect(() => isParserBijective(parseAsInteger, '42', 47)).toThrow() * ``` * * @param parser The parser to test * @param serialized The serialized representation of the input to test against * @param input An input value to test against * @returns `true` if the test passes, otherwise it will throw. */ declare function isParserBijective(parser: ParserBuilder, serialized: string, input: T): boolean; /** * Test that a parser is bijective (serialize then parse gives back the same value). * * It will throw if the parser is not bijective (if the parsed value is not equal to the input value). * The parser's `eq` function is used to compare the values. * * Usage: * ```ts * // Expect it to pass (no error thrown) * expect(testSerializeThenParse(myParser, 'foo')).toBe(true) * // Expect it to fail * expect(() => testSerializeThenParse(myParser, 'bar')).toThrow() * ``` * * @param parser The parser to test * @param input An input value to test against * @returns `true` if the test passes, otherwise it will throw. */ declare function testSerializeThenParse(parser: ParserBuilder, input: T): boolean; /** * Tests that a parser is bijective (parse then serialize gives back the same query string). * * It will throw if the parser is not bijective (if the serialized value is not equal to the input query). * * Usage: * ```ts * // Expect it to pass (no error thrown) * expect(testParseThenSerialize(myParser, 'foo')).toBe(true) * // Expect it to fail * expect(() => testParseThenSerialize(myParser, 'bar')).toThrow() * ``` * * @param parser The parser to test * @param input A query string to test against * @returns `true` if the test passes, otherwise it will throw. */ declare function testParseThenSerialize(parser: ParserBuilder, input: string): boolean; //#endregion export { isParserBijective, testParseThenSerialize, testSerializeThenParse }; //# sourceMappingURL=testing.d.ts.map