@ledgerhq/common
Advanced tools
Comparing version 4.8.0-rc1.1b178f67 to 4.12.0-beta.a9ddcef0
@@ -1,3 +0,3 @@ | ||
// flow-typed signature: ebbcd423b1fcd29d6804fca91bb68879 | ||
// flow-typed version: 7b9f6d2713/jest_v22.x.x/flow_>=v0.39.x | ||
// flow-typed signature: 5f6b80ba0fa4571aac1e7ea6e5fea425 | ||
// flow-typed version: f4a7859cd3/jest_v22.x.x/flow_>=v0.39.x | ||
@@ -59,2 +59,7 @@ type JestMockFn<TArguments: $ReadOnlyArray<*>, TReturn> = { | ||
/** | ||
* Accepts a string to use in test result output in place of "jest.fn()" to | ||
* indicate which mock function is being referenced. | ||
*/ | ||
mockName(name: string): JestMockFn<TArguments, TReturn>, | ||
/** | ||
* Just a simple sugar function for returning `this` | ||
@@ -148,4 +153,338 @@ */ | ||
// DOM testing library extensions https://github.com/kentcdodds/dom-testing-library#custom-jest-matchers | ||
type DomTestingLibraryType = { | ||
toBeInTheDOM(): void, | ||
toHaveTextContent(content: string): void, | ||
toHaveAttribute(name: string, expectedValue?: string): void | ||
}; | ||
// Jest JQuery Matchers: https://github.com/unindented/custom-jquery-matchers | ||
type JestJQueryMatchersType = { | ||
toExist(): void, | ||
toHaveLength(len: number): void, | ||
toHaveId(id: string): void, | ||
toHaveClass(className: string): void, | ||
toHaveTag(tag: string): void, | ||
toHaveAttr(key: string, val?: any): void, | ||
toHaveProp(key: string, val?: any): void, | ||
toHaveText(text: string | RegExp): void, | ||
toHaveData(key: string, val?: any): void, | ||
toHaveValue(val: any): void, | ||
toHaveCss(css: {[key: string]: any}): void, | ||
toBeChecked(): void, | ||
toBeDisabled(): void, | ||
toBeEmpty(): void, | ||
toBeHidden(): void, | ||
toBeSelected(): void, | ||
toBeVisible(): void, | ||
toBeFocused(): void, | ||
toBeInDom(): void, | ||
toBeMatchedBy(sel: string): void, | ||
toHaveDescendant(sel: string): void, | ||
toHaveDescendantWithText(sel: string, text: string | RegExp): void | ||
}; | ||
// Jest Extended Matchers: https://github.com/jest-community/jest-extended | ||
type JestExtendedMatchersType = { | ||
/** | ||
* Note: Currently unimplemented | ||
* Passing assertion | ||
* | ||
* @param {String} message | ||
*/ | ||
// pass(message: string): void; | ||
/** | ||
* Note: Currently unimplemented | ||
* Failing assertion | ||
* | ||
* @param {String} message | ||
*/ | ||
// fail(message: string): void; | ||
/** | ||
* Use .toBeEmpty when checking if a String '', Array [] or Object {} is empty. | ||
*/ | ||
toBeEmpty(): void; | ||
/** | ||
* Use .toBeOneOf when checking if a value is a member of a given Array. | ||
* @param {Array.<*>} members | ||
*/ | ||
toBeOneOf(members: any[]): void; | ||
/** | ||
* Use `.toBeNil` when checking a value is `null` or `undefined`. | ||
*/ | ||
toBeNil(): void; | ||
/** | ||
* Use `.toSatisfy` when you want to use a custom matcher by supplying a predicate function that returns a `Boolean`. | ||
* @param {Function} predicate | ||
*/ | ||
toSatisfy(predicate: (n: any) => boolean): void; | ||
/** | ||
* Use `.toBeArray` when checking if a value is an `Array`. | ||
*/ | ||
toBeArray(): void; | ||
/** | ||
* Use `.toBeArrayOfSize` when checking if a value is an `Array` of size x. | ||
* @param {Number} x | ||
*/ | ||
toBeArrayOfSize(x: number): void; | ||
/** | ||
* Use `.toIncludeAllMembers` when checking if an `Array` contains all of the same members of a given set. | ||
* @param {Array.<*>} members | ||
*/ | ||
toIncludeAllMembers(members: any[]): void; | ||
/** | ||
* Use `.toIncludeAnyMembers` when checking if an `Array` contains any of the members of a given set. | ||
* @param {Array.<*>} members | ||
*/ | ||
toIncludeAnyMembers(members: any[]): void; | ||
/** | ||
* Use `.toSatisfyAll` when you want to use a custom matcher by supplying a predicate function that returns a `Boolean` for all values in an array. | ||
* @param {Function} predicate | ||
*/ | ||
toSatisfyAll(predicate: (n: any) => boolean): void; | ||
/** | ||
* Use `.toBeBoolean` when checking if a value is a `Boolean`. | ||
*/ | ||
toBeBoolean(): void; | ||
/** | ||
* Use `.toBeTrue` when checking a value is equal (===) to `true`. | ||
*/ | ||
toBeTrue(): void; | ||
/** | ||
* Use `.toBeFalse` when checking a value is equal (===) to `false`. | ||
*/ | ||
toBeFalse(): void; | ||
/** | ||
* Use .toBeDate when checking if a value is a Date. | ||
*/ | ||
toBeDate(): void; | ||
/** | ||
* Use `.toBeFunction` when checking if a value is a `Function`. | ||
*/ | ||
toBeFunction(): void; | ||
/** | ||
* Use `.toHaveBeenCalledBefore` when checking if a `Mock` was called before another `Mock`. | ||
* | ||
* Note: Required Jest version >22 | ||
* Note: Your mock functions will have to be asynchronous to cause the timestamps inside of Jest to occur in a differentJS event loop, otherwise the mock timestamps will all be the same | ||
* | ||
* @param {Mock} mock | ||
*/ | ||
toHaveBeenCalledBefore(mock: JestMockFn<any, any>): void; | ||
/** | ||
* Use `.toBeNumber` when checking if a value is a `Number`. | ||
*/ | ||
toBeNumber(): void; | ||
/** | ||
* Use `.toBeNaN` when checking a value is `NaN`. | ||
*/ | ||
toBeNaN(): void; | ||
/** | ||
* Use `.toBeFinite` when checking if a value is a `Number`, not `NaN` or `Infinity`. | ||
*/ | ||
toBeFinite(): void; | ||
/** | ||
* Use `.toBePositive` when checking if a value is a positive `Number`. | ||
*/ | ||
toBePositive(): void; | ||
/** | ||
* Use `.toBeNegative` when checking if a value is a negative `Number`. | ||
*/ | ||
toBeNegative(): void; | ||
/** | ||
* Use `.toBeEven` when checking if a value is an even `Number`. | ||
*/ | ||
toBeEven(): void; | ||
/** | ||
* Use `.toBeOdd` when checking if a value is an odd `Number`. | ||
*/ | ||
toBeOdd(): void; | ||
/** | ||
* Use `.toBeWithin` when checking if a number is in between the given bounds of: start (inclusive) and end (exclusive). | ||
* | ||
* @param {Number} start | ||
* @param {Number} end | ||
*/ | ||
toBeWithin(start: number, end: number): void; | ||
/** | ||
* Use `.toBeObject` when checking if a value is an `Object`. | ||
*/ | ||
toBeObject(): void; | ||
/** | ||
* Use `.toContainKey` when checking if an object contains the provided key. | ||
* | ||
* @param {String} key | ||
*/ | ||
toContainKey(key: string): void; | ||
/** | ||
* Use `.toContainKeys` when checking if an object has all of the provided keys. | ||
* | ||
* @param {Array.<String>} keys | ||
*/ | ||
toContainKeys(keys: string[]): void; | ||
/** | ||
* Use `.toContainAllKeys` when checking if an object only contains all of the provided keys. | ||
* | ||
* @param {Array.<String>} keys | ||
*/ | ||
toContainAllKeys(keys: string[]): void; | ||
/** | ||
* Use `.toContainAnyKeys` when checking if an object contains at least one of the provided keys. | ||
* | ||
* @param {Array.<String>} keys | ||
*/ | ||
toContainAnyKeys(keys: string[]): void; | ||
/** | ||
* Use `.toContainValue` when checking if an object contains the provided value. | ||
* | ||
* @param {*} value | ||
*/ | ||
toContainValue(value: any): void; | ||
/** | ||
* Use `.toContainValues` when checking if an object contains all of the provided values. | ||
* | ||
* @param {Array.<*>} values | ||
*/ | ||
toContainValues(values: any[]): void; | ||
/** | ||
* Use `.toContainAllValues` when checking if an object only contains all of the provided values. | ||
* | ||
* @param {Array.<*>} values | ||
*/ | ||
toContainAllValues(values: any[]): void; | ||
/** | ||
* Use `.toContainAnyValues` when checking if an object contains at least one of the provided values. | ||
* | ||
* @param {Array.<*>} values | ||
*/ | ||
toContainAnyValues(values: any[]): void; | ||
/** | ||
* Use `.toContainEntry` when checking if an object contains the provided entry. | ||
* | ||
* @param {Array.<String, String>} entry | ||
*/ | ||
toContainEntry(entry: [string, string]): void; | ||
/** | ||
* Use `.toContainEntries` when checking if an object contains all of the provided entries. | ||
* | ||
* @param {Array.<Array.<String, String>>} entries | ||
*/ | ||
toContainEntries(entries: [string, string][]): void; | ||
/** | ||
* Use `.toContainAllEntries` when checking if an object only contains all of the provided entries. | ||
* | ||
* @param {Array.<Array.<String, String>>} entries | ||
*/ | ||
toContainAllEntries(entries: [string, string][]): void; | ||
/** | ||
* Use `.toContainAnyEntries` when checking if an object contains at least one of the provided entries. | ||
* | ||
* @param {Array.<Array.<String, String>>} entries | ||
*/ | ||
toContainAnyEntries(entries: [string, string][]): void; | ||
/** | ||
* Use `.toBeExtensible` when checking if an object is extensible. | ||
*/ | ||
toBeExtensible(): void; | ||
/** | ||
* Use `.toBeFrozen` when checking if an object is frozen. | ||
*/ | ||
toBeFrozen(): void; | ||
/** | ||
* Use `.toBeSealed` when checking if an object is sealed. | ||
*/ | ||
toBeSealed(): void; | ||
/** | ||
* Use `.toBeString` when checking if a value is a `String`. | ||
*/ | ||
toBeString(): void; | ||
/** | ||
* Use `.toEqualCaseInsensitive` when checking if a string is equal (===) to another ignoring the casing of both strings. | ||
* | ||
* @param {String} string | ||
*/ | ||
toEqualCaseInsensitive(string: string): void; | ||
/** | ||
* Use `.toStartWith` when checking if a `String` starts with a given `String` prefix. | ||
* | ||
* @param {String} prefix | ||
*/ | ||
toStartWith(prefix: string): void; | ||
/** | ||
* Use `.toEndWith` when checking if a `String` ends with a given `String` suffix. | ||
* | ||
* @param {String} suffix | ||
*/ | ||
toEndWith(suffix: string): void; | ||
/** | ||
* Use `.toInclude` when checking if a `String` includes the given `String` substring. | ||
* | ||
* @param {String} substring | ||
*/ | ||
toInclude(substring: string): void; | ||
/** | ||
* Use `.toIncludeRepeated` when checking if a `String` includes the given `String` substring the correct number of times. | ||
* | ||
* @param {String} substring | ||
* @param {Number} times | ||
*/ | ||
toIncludeRepeated(substring: string, times: number): void; | ||
/** | ||
* Use `.toIncludeMultiple` when checking if a `String` includes all of the given substrings. | ||
* | ||
* @param {Array.<String>} substring | ||
*/ | ||
toIncludeMultiple(substring: string[]): void; | ||
}; | ||
type JestExpectType = { | ||
not: JestExpectType & EnzymeMatchersType, | ||
not: JestExpectType & EnzymeMatchersType & DomTestingLibraryType & JestJQueryMatchersType & JestExtendedMatchersType, | ||
/** | ||
@@ -404,2 +743,9 @@ * If you have a mock function, you can use .lastCalledWith to test what | ||
*/ | ||
advanceTimersByTime(msToRun: number): void, | ||
/** | ||
* Executes only the macro task queue (i.e. all tasks queued by setTimeout() | ||
* or setInterval() and setImmediate()). | ||
* | ||
* Renamed to `advanceTimersByTime`. | ||
*/ | ||
runTimersToTime(msToRun: number): void, | ||
@@ -438,3 +784,3 @@ /** | ||
*/ | ||
spyOn(object: Object, methodName: string): JestMockFn<any, any>, | ||
spyOn(object: Object, methodName: string, accessType?: "get" | "set"): JestMockFn<any, any>, | ||
/** | ||
@@ -557,10 +903,56 @@ * Set the default timeout interval for tests and before/after hooks in milliseconds. | ||
type JestPrettyFormatColors = { | ||
comment: { close: string, open: string }, | ||
content: { close: string, open: string }, | ||
prop: { close: string, open: string }, | ||
tag: { close: string, open: string }, | ||
value: { close: string, open: string }, | ||
}; | ||
type JestPrettyFormatIndent = string => string; | ||
type JestPrettyFormatRefs = Array<any>; | ||
type JestPrettyFormatPrint = any => string; | ||
type JestPrettyFormatStringOrNull = string | null; | ||
type JestPrettyFormatOptions = {| | ||
callToJSON: boolean, | ||
edgeSpacing: string, | ||
escapeRegex: boolean, | ||
highlight: boolean, | ||
indent: number, | ||
maxDepth: number, | ||
min: boolean, | ||
plugins: JestPrettyFormatPlugins, | ||
printFunctionName: boolean, | ||
spacing: string, | ||
theme: {| | ||
comment: string, | ||
content: string, | ||
prop: string, | ||
tag: string, | ||
value: string, | ||
|}, | ||
|}; | ||
type JestPrettyFormatPlugin = { | ||
print: ( | ||
val: any, | ||
serialize: JestPrettyFormatPrint, | ||
indent: JestPrettyFormatIndent, | ||
opts: JestPrettyFormatOptions, | ||
colors: JestPrettyFormatColors, | ||
) => string, | ||
test: any => boolean, | ||
}; | ||
type JestPrettyFormatPlugins = Array<JestPrettyFormatPlugin>; | ||
/** The expect function is used every time you want to test a value */ | ||
declare var expect: { | ||
/** The object that you want to make assertions against */ | ||
(value: any): JestExpectType & JestPromiseType & EnzymeMatchersType, | ||
(value: any): JestExpectType & JestPromiseType & EnzymeMatchersType & DomTestingLibraryType & JestJQueryMatchersType & JestExtendedMatchersType, | ||
/** Add additional Jasmine matchers to Jest's roster */ | ||
extend(matchers: { [name: string]: JestMatcher }): void, | ||
/** Add a module that formats application-specific data structures. */ | ||
addSnapshotSerializer(serializer: (input: Object) => string): void, | ||
addSnapshotSerializer(pluginModule: JestPrettyFormatPlugin): void, | ||
assertions(expectedAssertions: number): void, | ||
@@ -567,0 +959,0 @@ hasAssertions(): void, |
{ | ||
"name": "@ledgerhq/common", | ||
"version": "4.8.0-rc1.1b178f67", | ||
"version": "4.12.0-beta.a9ddcef0", | ||
"description": "Ledger Hardware Wallet Common", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
862644
14175
168