rxjs-marbles
Advanced tools
Comparing version 2.2.0 to 2.3.0
@@ -0,1 +1,8 @@ | ||
<a name="2.3.0"></a> | ||
## [2.3.0](https://github.com/cartant/rxjs-marbles/compare/v2.2.0...v2.3.0) (2017-12-21) | ||
### Features | ||
* **Jest**: Use Jest's matcher for the marbles assertion. ([3721847](https://github.com/cartant/rxjs-marbles/commit/3721847)) | ||
<a name="2.2.0"></a> | ||
@@ -6,3 +13,3 @@ ## [2.2.0](https://github.com/cartant/rxjs-marbles/compare/v2.1.0...v2.2.0) (2017-11-30) | ||
* **bind**: Add a `'bind` method for binding non-test schedulers to the context's `TestScheduler`. ([3a7963c](https://github.com/cartant/rxjs-marbles/commit/3a7963c)) | ||
* **bind**: Add a `bind` method for binding non-test schedulers to the context's `TestScheduler`. ([3a7963c](https://github.com/cartant/rxjs-marbles/commit/3a7963c)) | ||
@@ -9,0 +16,0 @@ <a name="2.1.0"></a> |
export interface Configuration { | ||
assert?: (value: any, message: string) => void; | ||
assertDeepEqual?: (a: any, b: any) => void; | ||
frameworkMatcher?: boolean; | ||
} | ||
export declare function configure(options: Configuration): void; | ||
export declare function get<K extends keyof Configuration>(key: K): Configuration[K]; |
@@ -12,3 +12,4 @@ var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
assert: defaultAssert, | ||
assertDeepEqual: defaultAssertDeepEqual | ||
assertDeepEqual: defaultAssertDeepEqual, | ||
frameworkMatcher: false | ||
}; | ||
@@ -15,0 +16,0 @@ export function configure(options) { |
@@ -6,3 +6,2 @@ import { NamedCase, UnnamedCase } from "../cases"; | ||
export * from "../expect"; | ||
export * from "../marbles"; | ||
export declare function cases<T extends UnnamedCase>(name: string, func: (context: Context, _case: T) => void, cases: { | ||
@@ -12,1 +11,2 @@ [key: string]: T; | ||
export declare function cases<T extends NamedCase>(name: string, func: (context: Context, _case: T) => void, cases: T[]): void; | ||
export declare function marbles(func: (m: Context, ...rest: any[]) => void): any; |
import { _cases } from "../cases"; | ||
import { marbles } from "../marbles"; | ||
import { marbles as _marbles } from "../marbles"; | ||
export { configure } from "../configuration"; | ||
export * from "../context"; | ||
export * from "../expect"; | ||
export * from "../marbles"; | ||
export function cases(name, func, cases) { | ||
@@ -32,1 +31,14 @@ describe(name, function () { | ||
} | ||
export function marbles(func) { | ||
return _marbles(function (m) { | ||
var rest = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
rest[_i - 1] = arguments[_i]; | ||
} | ||
m.configure({ | ||
assertDeepEqual: function (a, e) { return expect(a).toEqual(e); }, | ||
frameworkMatcher: true | ||
}); | ||
func.apply(void 0, [m].concat(rest)); | ||
}); | ||
} |
@@ -12,3 +12,3 @@ import { TestScheduler } from "rxjs/testing/TestScheduler"; | ||
} | ||
var scheduler = new TestScheduler(function (a, b) { return observableMatcher(a, b, get("assert"), get("assertDeepEqual")); }); | ||
var scheduler = new TestScheduler(function (a, b) { return observableMatcher(a, b, get("assert"), get("assertDeepEqual"), get("frameworkMatcher")); }); | ||
var context = new Context(scheduler); | ||
@@ -24,3 +24,3 @@ func.apply(void 0, [context, first].concat(rest)); | ||
} | ||
var scheduler = new TestScheduler(function (a, b) { return observableMatcher(a, b, get("assert"), get("assertDeepEqual")); }); | ||
var scheduler = new TestScheduler(function (a, b) { return observableMatcher(a, b, get("assert"), get("assertDeepEqual"), get("frameworkMatcher")); }); | ||
var context = new Context(scheduler); | ||
@@ -27,0 +27,0 @@ func.apply(void 0, [context].concat(rest)); |
@@ -1,1 +0,1 @@ | ||
export declare function observableMatcher(actual: any, expected: any, assert: any, assertDeepEqual: any): any; | ||
export declare function observableMatcher(actual: any, expected: any, assert: any, assertDeepEqual: any, frameworkMatcher: any): any; |
@@ -26,16 +26,21 @@ import isEqual from "lodash-es/isEqual"; | ||
} | ||
export function observableMatcher(actual, expected, assert, assertDeepEqual) { | ||
export function observableMatcher(actual, expected, assert, assertDeepEqual, frameworkMatcher) { | ||
if (Array.isArray(actual) && Array.isArray(expected)) { | ||
actual = actual.map(deleteErrorNotificationStack); | ||
expected = expected.map(deleteErrorNotificationStack); | ||
var passed = isEqual(actual, expected); | ||
if (passed) { | ||
assert(true, ""); | ||
return; | ||
if (frameworkMatcher) { | ||
assertDeepEqual(actual, expected); | ||
} | ||
var message_1 = '\nExpected \n'; | ||
actual.forEach(function (x) { return message_1 += "\t" + stringify(x) + "\n"; }); | ||
message_1 += '\t\nto deep equal \n'; | ||
expected.forEach(function (x) { return message_1 += "\t" + stringify(x) + "\n"; }); | ||
assert(passed, message_1); | ||
else { | ||
var passed = isEqual(actual, expected); | ||
if (passed) { | ||
assert(true, ""); | ||
return; | ||
} | ||
var message_1 = '\nExpected \n'; | ||
actual.forEach(function (x) { return message_1 += "\t" + stringify(x) + "\n"; }); | ||
message_1 += '\t\nto deep equal \n'; | ||
expected.forEach(function (x) { return message_1 += "\t" + stringify(x) + "\n"; }); | ||
assert(passed, message_1); | ||
} | ||
} | ||
@@ -42,0 +47,0 @@ else { |
@@ -43,4 +43,4 @@ { | ||
"unpkg": "./bundles/rxjs-marbles.umd.js", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"ava": {} | ||
} |
@@ -248,2 +248,3 @@ # rxjs-marbles | ||
assertDeepEqual?: (a: any, b: any) => void; | ||
frameworkMatcher?: boolean; | ||
} | ||
@@ -250,0 +251,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
441899
12894
295