This repository has been archived by the owner on Oct 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
25 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,40 @@ | ||
declare namespace jaymock { | ||
type ExtensionName = string | {[key: string]: Function}; | ||
type Functions = {[key: string]: Function}; | ||
type Instance = {template: jaymock.Template, functions: jaymock.Functions} | ||
interface Template { | ||
[key: string]: string | number | Template; | ||
} | ||
interface Populated { | ||
[key: string]: unknown | Array<Populated> | Populated; | ||
} | ||
interface Method { | ||
/** | ||
Populates the template object with fake data. | ||
@param template - A [`template`](https://github.com/unmock/jaymock#template) object to populate. | ||
@returns An `object` populated with fake data. | ||
*/ | ||
populate(template: jaymock.Template): jaymock.Populated; | ||
} | ||
|
||
/** | ||
Adds a custom data generation function that can be called in the `populate` `template` object using the value of its `name`. | ||
@param name - A `string` used to refer to the `body` function. | ||
@param body - A `function` that can be referred to in the `template` object. | ||
*/ | ||
extend(name: jaymock.ExtensionName, body?: Function): void; | ||
declare function jaymock(): { | ||
/** | ||
Populates the template object with fake data. | ||
@param template - A [`template`](https://github.com/unmock/jaymock#template) object to populate. | ||
@returns An `object` populated with fake data. | ||
*/ | ||
populate(template: jaymock.Template): jaymock.Populated; | ||
|
||
/** | ||
Sets `Faker.js`'s language locale. | ||
@param locale - `Faker.js` locale. | ||
*/ | ||
setFakerLocale(locale: string): void; | ||
/** | ||
Adds a custom data generation function that can be called in the `populate` `template` object using the value of its `name`. | ||
@param name - A `string` used to refer to the `body` function. | ||
@param body - A `function` that can be referred to in the `template` object. | ||
*/ | ||
extend(name: jaymock.ExtensionName, body?: Function): void; | ||
|
||
/** | ||
Sets `Faker.js`'s randomness seed. | ||
@param seed - `Faker.js` randomness seed. | ||
*/ | ||
setFakerSeed(seed: number): void; | ||
} | ||
} | ||
/** | ||
Sets `Faker.js`'s language locale. | ||
@param locale - `Faker.js` locale. | ||
*/ | ||
setFakerLocale(locale: string): void; | ||
|
||
declare function jaymock(): jaymock.Instance & jaymock.Method; | ||
/** | ||
Sets `Faker.js`'s randomness seed. | ||
@param seed - `Faker.js` randomness seed. | ||
*/ | ||
setFakerSeed(seed: number): void; | ||
}; | ||
|
||
export = jaymock; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters