@humanfs/test
Version:
Testing utilities for hfs
70 lines (69 loc) • 1.81 kB
TypeScript
export class HfsImplTester {
/**
* Creates a new instance.
* @param {object} options Options for the tester.
* @param {Assert} options.assert The assert function to use.
* @param {BddTest} options.test The test library to use.
* @param {string} options.outputDir The directory where output files should be written.
* @param {string[]} [options.expectedEntries] The expected entries in the output directory.
*/
constructor({ assert, test, outputDir, expectedEntries }: {
assert: Assert;
test: BddTest;
outputDir: string;
expectedEntries?: string[];
});
/**
* Runs the tests.
* @param {object} options Options for the test.
* @param {string} options.name The name of the test.
* @param {HfsImpl} options.impl The HfsImpl instance to test.
* @returns {Promise<void>}
*/
test({ name, impl }: {
name: string;
impl: HfsImpl;
}): Promise<void>;
#private;
}
export type HfsImpl = import("@humanfs/types").HfsImpl;
export type Assert = {
/**
* Asserts that two values are strictly equal.
*/
strictEqual: Function;
/**
* Asserts that a promise rejects.
*/
rejects: Function;
/**
* Asserts that two values are deeply equal.
*/
deepStrictEqual: Function;
/**
* Asserts that a value is truthy.
*/
ok: Function;
/**
* Asserts that a value is falsy.
*/
fail: Function;
};
export type BddTest = {
/**
* A test function.
*/
it: Function;
/**
* A test suite function.
*/
describe: Function;
/**
* A function to run before each test.
*/
beforeEach: Function;
/**
* A function to run after each test.
*/
afterEach: Function;
};