/// import * as events from 'events'; import { INilCallback } from 'util.toolbox'; export interface IPatternOpts { columns?: number; chevrons?: string[]; repeat?: number; } export interface IFixtureOpts { basedir?: string; dataFile?: string; fixtureDirectory?: string; jsonFile?: string; script?: string; templateData?: { [name: string]: string; }; loremIpsum?: any; pattern?: IPatternOpts; } export interface IFixtureCallback extends INilCallback { (err: Error | null, directories: string[] | any): void | null; } /** Creates an instance of a fixture */ export declare class Fixture extends events.EventEmitter { /** * Removes all of the temporary directories that were created by fixtures * in test cases. Each fixture registers the directory it created when it * was instantiated. This will iterate through all of those directories and * remove them. It should be called as the last step in any testing. * @param [cb] {FixtureCallback} a callback function exectued when the cleanup * procedure is complete. The callback parameters are: * * - err {Error}: error object if an error has occurred. Null if no error has * occurred. * - directories {string[]}: a list of the directories that were removed. * */ static cleanup(cb?: IFixtureCallback): void; private _basedir; private _dir; private _data; private _files; private _loremIpsum; private _name; private _obj; private _opts; private _pattern; private _src; /** * Creates an instance of a fixture object for use in a unit test. By * default it looks lin ./test/fixtures. * @param [name] {string} the name of the fixture to load * @param [opts] {object} optional arguments (see README for details) * @constructor */ constructor(name?: string, opts?: IFixtureOpts); /** * Generates a test pattern string. The generated string is created from a * list of chevrons. Each chevron is a full row of N columns. The default * string is 26 rows with 80 columns, where each default chevron is A-Z */ private patternGenerator; /** * Takes a file name within the fixture, and reads the contents of the * file into a buffer and returns it. This is the name of the relative path * and file within the fixture. * @param filename {string} the name of the file within the fixture to read. * @returns a string representing the contents of the requested file. */ read(filename: string): string; /** * Sets the base location for the temporariy files that this Fixture instance * will use. * @returns {string} the path location for the base directory */ setBaseDirectory(): string; /** * Returns a string representation of the internal object structure of * the Fixture. * @returns {string} the string representing the object. */ toString(): string; basedir: string; readonly data: string[]; readonly dir: string; readonly files: string[]; readonly loremIpsum: string; readonly name: string; readonly obj: any; readonly pattern: string; readonly src: string; }