/** * TestTargetResult * @template Outcome * @typedef TestTargetResult - TestResult for a single one of the test targets * @property {"TestResult"} type * @property {Outcome} outcome * @property {string} name * @property {unknown} pointer - pointer to the test target that was tested to produce this result */ /** * TestResult * https://www.w3.org/TR/EARL10-Schema/#TestResult * @template Outcome * @template [Pointer=unknown] - type of allowed pointers * @typedef TestResult * @property {"TestResult"} [type] * @property {string} [info] - additional info about the result in human-readable form * @property {Outcome} outcome * @property {TestTargetResult[]} [source] * @property {Pointer} [pointer] */ /** * @typedef TestEnvironment * @property {typeof globalThis.fetch} [fetch] */ /** * TestCase * @template Inputs * @typedef TestCase * @property {{ [I in keyof Inputs]: { help: string }}} inputs * @property {string} markdown * @property {string} name * @property {string} description * @property {string} slug * @property {URL} [url] * @property {string} uuid * @property {(inputs: Inputs, env?: TestEnvironment) => Promise>} run * @property {Iterable>} inapplicableCases * @property {Iterable>} passedCases * @property {Iterable>} failedCases */ /** * Outcome * @typedef {"passed"|"failed"|"inapplicable"|"cantTell"|"untested"} Outcome * @see https://www.w3.org/TR/EARL10-Schema/#OutcomeValue */ /** * TestCaseExample * an example of applying a test case with specific inputs expected result * @template Inputs * @template {Outcome} [O=Outcome] * @typedef TestCaseExample * @property {string} name * @property {Inputs} inputs * @property {TestResult} result * @property {any} [targets] */ /** * @template Inputs * @template Outcome * @param {object} test * @param {Iterable>} test.passedCases * @param {(inputs: Inputs) => Promise>} test.run * @param {object} options * @param {number} [options.minimum=0] - minimum required passedCases */ export function testHasPassedCases({ passedCases, run }: { passedCases: Iterable>; run: (inputs: Inputs) => Promise>; }, { minimum }?: { minimum?: number | undefined; }): Promise; /** * @template Inputs * @param {object} options * @param {Iterable>} options.failedCases * @param {(inputs: Inputs) => Promise>} options.run * @param {object} options * @param {number} [options.minimum=0] - minimum required cases */ export function testHasFailedCases({ failedCases, run }: { failedCases: Iterable>; run: (inputs: Inputs) => Promise>; }, { minimum }?: { minimum?: number | undefined; }): Promise; /** * @template Inputs * @template Outcome * @param {object} options * @param {Iterable>} options.inapplicableCases * @param {(inputs: Inputs) => Promise>} options.run * @param {object} options * @param {number} [options.minimum=0] - minimum required cases */ export function testHasInapplicableCases({ inapplicableCases, run }: { inapplicableCases: Iterable>; run: (inputs: Inputs) => Promise>; }, { minimum }?: { minimum?: number | undefined; }): Promise; export const testingContextJsonUrl: "https://socialweb.coop/ns/testing/context.json"; export const assertionLdContext: string[]; /** * @template Inputs */ export class TestSummary { /** * @param {import("./test-utils").TestCase} options */ constructor({ slug, url, description, name, uuid }: import("./test-utils").TestCase); slug: string; url: string | URL; description: string; name: string; uuid: string; } /** * @template Inputs * @template Outcome * @template [Pointer=unknown] */ export class Assertion { /** * @param {TestSummary} test * @param {Inputs} input * @param {import("./test-utils").TestResult} result */ constructor(test: TestSummary, input: Inputs, result: import("./test-utils").TestResult); type: string[]; result: TestResult; test: TestSummary; input: Inputs; '@context': string[]; } /** * - TestResult for a single one of the test targets */ export type TestTargetResult = { type: "TestResult"; outcome: Outcome; name: string; /** * - pointer to the test target that was tested to produce this result */ pointer: unknown; }; /** * TestResult * https://www.w3.org/TR/EARL10-Schema/#TestResult */ export type TestResult = { type?: "TestResult" | undefined; /** * - additional info about the result in human-readable form */ info?: string | undefined; outcome: Outcome; source?: TestTargetResult[] | undefined; pointer?: Pointer | undefined; }; export type TestEnvironment = { fetch?: typeof fetch | undefined; }; /** * TestCase */ export type TestCase = { inputs: { [I in keyof Inputs]: { help: string; }; }; markdown: string; name: string; description: string; slug: string; url?: URL | undefined; uuid: string; run: (inputs: Inputs, env?: TestEnvironment) => Promise>; inapplicableCases: Iterable>; passedCases: Iterable>; failedCases: Iterable>; }; /** * Outcome */ export type Outcome = "passed" | "failed" | "inapplicable" | "cantTell" | "untested"; /** * TestCaseExample * an example of applying a test case with specific inputs expected result */ export type TestCaseExample = { name: string; inputs: Inputs; result: TestResult; targets?: any; }; //# sourceMappingURL=test-utils.d.ts.map