accounts-frontend/@types/unexpected.d.ts

78 lines
2.4 KiB
TypeScript
Raw Normal View History

declare module 'unexpected' {
2020-05-24 04:38:24 +05:30
namespace unexpected {
interface EnchantedPromise<T> extends Promise<T> {
and<A extends Array<unknown> = []>(
assertionName: string,
subject: unknown,
...args: A
): EnchantedPromise<any>;
}
2020-05-24 04:38:24 +05:30
interface Expect {
/**
* @see http://unexpected.js.org/api/expect/
*/
<A extends Array<unknown> = []>(subject: unknown, assertionName: string, ...args: A): EnchantedPromise<any>;
2020-05-24 04:38:24 +05:30
it<A extends Array<unknown> = []>(
assertionName: string,
subject?: unknown,
...args: A
): EnchantedPromise<any>;
2020-05-24 04:38:24 +05:30
/**
* @see http://unexpected.js.org/api/clone/
*/
clone(): this;
2020-05-24 04:38:24 +05:30
/**
* @see http://unexpected.js.org/api/addAssertion/
*/
addAssertion<T, A extends Array<unknown> = []>(
pattern: string,
handler: (expect: Expect, subject: T, ...args: A) => void,
): this;
2020-05-24 04:38:24 +05:30
/**
* @see http://unexpected.js.org/api/addType/
*/
addType<T>(typeDefinition: unexpected.TypeDefinition<T>): this;
2020-05-24 04:38:24 +05:30
/**
* @see http://unexpected.js.org/api/fail/
*/
fail<A extends Array<unknown> = []>(format: string, ...args: A): void;
fail<E extends Error>(error: E): void;
2020-05-24 04:38:24 +05:30
/**
* @see http://unexpected.js.org/api/freeze/
*/
freeze(): this;
2020-05-24 04:38:24 +05:30
/**
* @see http://unexpected.js.org/api/use/
*/
use(plugin: unexpected.PluginDefinition): this;
}
2020-05-24 04:38:24 +05:30
interface PluginDefinition {
name?: string;
version?: string;
dependencies?: Array<string>;
installInto(expect: Expect): void;
}
2020-05-24 04:38:24 +05:30
interface TypeDefinition<T> {
name: string;
identify(value: unknown): value is T;
base?: string;
equal?(a: T, b: T, equal: (a: unknown, b: unknown) => boolean): boolean;
inspect?(value: T, depth: number, output: any, inspect: (value: unknown, depth: number) => any): void;
}
}
2020-05-24 04:38:24 +05:30
const unexpected: unexpected.Expect;
2020-05-24 04:38:24 +05:30
export = unexpected;
}