1 | import { ExecutionContext } from 'ava';
|
2 | export { readJsonFile as readJsonFixture } from './FileUtils';
|
3 | export declare const inTestMode: () => boolean;
|
4 | /**
|
5 | * Helper function to throw error for unit test exports
|
6 | * @throws {Error}
|
7 | */
|
8 | export declare const throwTestError: () => never;
|
9 | /**
|
10 | * Generate a [40 character] random string
|
11 | *
|
12 | * @param {number} numBytes - number of bytes to use in creating a random string
|
13 | * defaults to 20 to produce a 40 character string
|
14 | * @returns {string} - a random string
|
15 | */
|
16 | export declare const randomString: (numBytes?: number) => string;
|
17 | /**
|
18 | * Postpend a [10-character] random string to input identifier.
|
19 | *
|
20 | * @param {string} id - identifer to return
|
21 | * @param {number} numBytes - number of bytes to use to compute random
|
22 | * extension. Default 5 to produce 10 characters..
|
23 | * @returns {string} - a random string
|
24 | */
|
25 | export declare const randomId: (id: string, numBytes?: number) => string;
|
26 | /**
|
27 | * Generate a random for the given scale.
|
28 | *
|
29 | * Defaults to a number between 1 and 10.
|
30 | *
|
31 | * @param {number} scale - scale for the random number. Defaults to 10.
|
32 | * @returns {number} - a random number
|
33 | */
|
34 | export declare const randomNumber: (scale?: number) => number;
|
35 | /**
|
36 | * Create a random granule id from the regular expression
|
37 | *
|
38 | * @param {string} regex - regular expression string
|
39 | * @returns {string} - random granule id
|
40 | */
|
41 | export declare const randomStringFromRegex: (regex: string) => string;
|
42 | /**
|
43 | * Validate a task input object using json-schema
|
44 | *
|
45 | * Issues a test failure if there were validation errors
|
46 | *
|
47 | * @param {Object} t - an ava test
|
48 | * @param {Object} data - the object to be validated
|
49 | * @returns {Promise<undefined>}
|
50 | */
|
51 | export declare function validateInput(t: ExecutionContext, data: unknown): Promise<void>;
|
52 | /**
|
53 | * Validate a task config object using json-schema
|
54 | *
|
55 | * Issues a test failure if there were validation errors
|
56 | *
|
57 | * @param {Object} t - an ava test
|
58 | * @param {Object} data - the object to be validated
|
59 | * @returns {Promise<undefined>}
|
60 | */
|
61 | export declare function validateConfig(t: ExecutionContext, data: unknown): Promise<void>;
|
62 | /**
|
63 | * Validate a task output object using json-schema
|
64 | *
|
65 | * Issues a test failure if there were validation errors
|
66 | *
|
67 | * @param {Object} t - an ava test
|
68 | * @param {Object} data - the object to be validated
|
69 | * @returns {Promise<undefined>}
|
70 | */
|
71 | export declare function validateOutput(t: ExecutionContext, data: unknown): Promise<void>;
|
72 | /**
|
73 | * Determine the path of the current git repo
|
74 | *
|
75 | * @param {string} dirname - the directory that you're trying to find the git
|
76 | * root for
|
77 | * @returns {Promise.<string>} - the filesystem path of the current git repo
|
78 | */
|
79 | export declare function findGitRepoRootDirectory(dirname: string): Promise<string>;
|
80 | /**
|
81 | * Determine the path of the packages/test-data directory
|
82 | *
|
83 | * @returns {Promise.<string>} - the filesystem path of the packages/test-data
|
84 | * directory
|
85 | */
|
86 | export declare function findTestDataDirectory(): Promise<string>;
|
87 | /**
|
88 | * Prettify and display something to the console.
|
89 | *
|
90 | * This is only intended to be used during debugging.
|
91 | *
|
92 | * @param {Object|Array} object - an object or array to be stringifyed
|
93 | * @returns {undefined} - no return value
|
94 | */
|
95 | export declare function jlog(object: unknown): void;
|
96 | //# sourceMappingURL=test-utils.d.ts.map |
\ | No newline at end of file |