/** * 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] */ /** * @typedef InputDescription * @property {string} help * @property {boolean} [required] * @property {unknown} [default] * @property {string | string[]} [type] * @property {string[]} [rangeIncludes] * @property {unknown[]} [constraints] */ /** * TestCase * @template [Inputs=unknown] * @template {string} [_Outcome=Outcome] * @typedef TestCase * @property {{ [I in keyof Inputs]: InputDescription}} input * @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>} [testCases] * @property {Iterable>} [inapplicableCases] * @property {Iterable>} [passedCases] * @property {Iterable>} [failedCases] * @property {Iterable} [isPartOf] * @property {Iterable<{ id: URL, url?: URL }>} [requirementReference] - links to specification requirements that the test case is testing. a la https://solidproject.org/ED/qa#test-case-description * @property {string} [applicability] - https://www.w3.org/TR/act-rules-format/#applicability * @property {string} [expectations] - https://www.w3.org/TR/act-rules-format/#expectations * @property {string} [assumptions] - https://www.w3.org/TR/act-rules-format/#assumptions * @property {Array} [attributedTo] */ /** * 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 {string} [id] * @property {Inputs} input * @property {TestResult} result * @property {any} [targets] */ /** * @template Inputs * @template Outcome * @param {object} test * @param {Iterable>} [test.passedCases] * @param {(input: Inputs) => Promise>} test.run * @param {object} options * @param {number} [options.minimum=0] - minimum required passedCases */ export function testHasPassedCases({ passedCases, run }: { passedCases?: Iterable> | undefined; run: (input: Inputs) => Promise>; }, { minimum }?: { minimum?: number | undefined; }): Promise; /** * @template Inputs * @template {string} Outcome * @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> | undefined; 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> | undefined; run: (inputs: Inputs) => Promise>; }, { minimum }?: { minimum?: number | undefined; }): Promise; /** * Given a test input, and the test case description, * return a version of input that can go in an Assertion. * The returned value may omit sensitive values like security credentials. * @template Input * @template {string} Outcome * @param {Input} input * @param {import("./test-utils").TestCase} testCase */ export function createAssertionInput(input: Input, testCase: TestCase, console?: Console): any; export const testingContextJsonUrl: "https://socialweb.coop/ns/testing/context.json"; export const assertionLdContext: string[]; /** * @template Inputs * @template {string} Outcome */ export class TestSummary { /** * @param {import("./test-utils").TestCase} options */ constructor({ slug, url, description, name, uuid, requirementReference }: import("./test-utils").TestCase); slug: string; url: URL | undefined; description: string; name: string; id: string; requirementReference: { id: string; url: string | undefined; }[]; } /** * @template Inputs * @template {string} 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; }; export type InputDescription = { help: string; required?: boolean | undefined; default?: unknown; type?: string | string[] | undefined; rangeIncludes?: string[] | undefined; constraints?: unknown[] | undefined; }; /** * TestCase */ export type TestCase = { input: { [I in keyof Inputs]: InputDescription; }; markdown?: string | undefined; name: string; description: string; slug: string; url?: URL | undefined; uuid: string; run: (inputs: Inputs, env?: TestEnvironment) => Promise>; testCases?: Iterable> | undefined; inapplicableCases?: Iterable> | undefined; passedCases?: Iterable> | undefined; failedCases?: Iterable> | undefined; isPartOf?: Iterable | undefined; /** * - links to specification requirements that the test case is testing. a la https://solidproject.org/ED/qa#test-case-description */ requirementReference?: Iterable<{ id: URL; url?: URL | undefined; }> | undefined; /** * - https://www.w3.org/TR/act-rules-format/#applicability */ applicability?: string | undefined; /** * - https://www.w3.org/TR/act-rules-format/#expectations */ expectations?: string | undefined; /** * - https://www.w3.org/TR/act-rules-format/#assumptions */ assumptions?: string | undefined; attributedTo?: (string | { name: string; url?: URL | undefined; })[] | undefined; }; /** * 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; id?: string | undefined; input: Inputs; result: TestResult; targets?: any; }; //# sourceMappingURL=test-utils.d.ts.map