UNPKG

andculturecode-javascript-testing

Version:
45 lines (44 loc) 1.37 kB
/// <reference types="faker" /> declare const TestUtils: { faker: Faker.FakerStatic; /** * Randomize case of string */ randomCase(value: string): string; /** * Wrapper around `faker.system.fileName` */ randomFilename(): string; /** * Wrapper around `faker.datatype.uuid` */ randomGuid(): string; /** * Returns a random key from the given object. If the object has no keys, it returns `undefined`. */ randomKey(obj: object): string; /** * Generates random object */ randomObject(keyCount?: number | undefined): Record<string, string>; /** * Generates random path */ randomPath(): string; /** * Returns a random value from the given object. If the object has no keys, it returns `undefined`. */ randomValue<TValue = any>(obj: Record<string, TValue> | TValue[]): TValue; /** * Wrapper of faker.random.word. * * Unfortunately there is an unresolved bug https://github.com/Marak/faker.js/issues/661 * and it will occasionally return multiple which can cause test flake */ randomWord(): string; /** * Returns a string array of at least two random words, leveraging the `TestUtils.randomWord` function */ randomWords(): string[]; }; export { TestUtils };