jasmine-marbles
Advanced tools
Comparing version 0.2.0 to 0.3.0
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('rxjs/Notification'), require('rxjs/Observable'), require('rxjs/testing/TestScheduler'), require('lodash')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'rxjs/Notification', 'rxjs/Observable', 'rxjs/testing/TestScheduler', 'lodash'], factory) : | ||
(factory((global['jasmine-marbles'] = global['jasmine-marbles'] || {}),global.rxjs_Notification,global.Rx,global.Rx,global._)); | ||
}(this, (function (exports,rxjs_Notification,rxjs_Observable,rxjs_testing_TestScheduler,_) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('rxjs'), require('rxjs/testing'), require('lodash')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'rxjs', 'rxjs/testing', 'lodash'], factory) : | ||
(factory((global['jasmine-marbles'] = global['jasmine-marbles'] || {}),global.Rx,global.Rx,global._)); | ||
}(this, (function (exports,rxjs,rxjs_testing,_) { 'use strict'; | ||
@@ -259,3 +259,3 @@ /** | ||
function initTestScheduler() { | ||
scheduler = new rxjs_testing_TestScheduler.TestScheduler(observableMatcher); | ||
scheduler = new rxjs_testing.TestScheduler(observableMatcher); | ||
} | ||
@@ -282,3 +282,3 @@ function getTestScheduler() { | ||
})(); | ||
var TestColdObservable = (function (_super) { | ||
var TestColdObservable = /** @class */ (function (_super) { | ||
__extends(TestColdObservable, _super); | ||
@@ -293,5 +293,8 @@ function TestColdObservable(marbles, values, error) { | ||
} | ||
TestColdObservable.prototype.getSubscriptions = function () { | ||
return this.source['subscriptions']; | ||
}; | ||
return TestColdObservable; | ||
}(rxjs_Observable.Observable)); | ||
var TestHotObservable = (function (_super) { | ||
}(rxjs.Observable)); | ||
var TestHotObservable = /** @class */ (function (_super) { | ||
__extends(TestHotObservable, _super); | ||
@@ -306,4 +309,7 @@ function TestHotObservable(marbles, values, error) { | ||
} | ||
TestHotObservable.prototype.getSubscriptions = function () { | ||
return this.source['subscriptions']; | ||
}; | ||
return TestHotObservable; | ||
}(rxjs_Observable.Observable)); | ||
}(rxjs.Observable)); | ||
@@ -330,3 +336,3 @@ function hot(marbles, values, error) { | ||
frame: scheduler.frame - outerFrame, | ||
notification: rxjs_Notification.Notification.createNext(value), | ||
notification: rxjs.Notification.createNext(value), | ||
}); | ||
@@ -336,3 +342,3 @@ }, function (err) { | ||
frame: scheduler.frame - outerFrame, | ||
notification: rxjs_Notification.Notification.createError(err), | ||
notification: rxjs.Notification.createError(err), | ||
}); | ||
@@ -342,3 +348,3 @@ }, function () { | ||
frame: scheduler.frame - outerFrame, | ||
notification: rxjs_Notification.Notification.createComplete(), | ||
notification: rxjs.Notification.createComplete(), | ||
}); | ||
@@ -350,2 +356,12 @@ }); | ||
jasmine.addMatchers({ | ||
toHaveSubscriptions: function () { return ({ | ||
compare: function (actual, marbles) { | ||
var marblesArray = typeof marbles === 'string' ? [marbles] : marbles; | ||
var results = marblesArray.map(function (marbles) { | ||
return rxjs_testing.TestScheduler.parseMarblesAsSubscriptions(marbles); | ||
}); | ||
expect(results).toEqual(actual.getSubscriptions()); | ||
return { pass: true }; | ||
}, | ||
}); }, | ||
toBeObservable: function () { return ({ | ||
@@ -360,3 +376,3 @@ compare: function (actual, fixture) { | ||
// Support Observable-of-Observables | ||
if (x instanceof rxjs_Observable.Observable) { | ||
if (x instanceof rxjs.Observable) { | ||
value = materializeInnerObservable(value, scheduler.frame); | ||
@@ -366,3 +382,3 @@ } | ||
frame: scheduler.frame, | ||
notification: rxjs_Notification.Notification.createNext(value), | ||
notification: rxjs.Notification.createNext(value), | ||
}); | ||
@@ -372,3 +388,3 @@ }, function (err) { | ||
frame: scheduler.frame, | ||
notification: rxjs_Notification.Notification.createError(err), | ||
notification: rxjs.Notification.createError(err), | ||
}); | ||
@@ -378,3 +394,3 @@ }, function () { | ||
frame: scheduler.frame, | ||
notification: rxjs_Notification.Notification.createComplete(), | ||
notification: rxjs.Notification.createComplete(), | ||
}); | ||
@@ -384,3 +400,3 @@ }); | ||
scheduler.flush(); | ||
var expected = rxjs_testing_TestScheduler.TestScheduler.parseMarbles(fixture.marbles, fixture.values, fixture.error, true); | ||
var expected = rxjs_testing.TestScheduler.parseMarbles(fixture.marbles, fixture.values, fixture.error, true); | ||
expect(results).toEqual(expected); | ||
@@ -387,0 +403,0 @@ return { pass: true }; |
@@ -10,2 +10,3 @@ import { TestColdObservable, TestHotObservable } from './src/test-observables'; | ||
toBeObservable: any; | ||
toHaveSubscriptions: any; | ||
} | ||
@@ -12,0 +13,0 @@ } |
@@ -1,4 +0,3 @@ | ||
import { Notification } from 'rxjs/Notification'; | ||
import { Observable } from 'rxjs/Observable'; | ||
import { TestScheduler } from 'rxjs/testing/TestScheduler'; | ||
import { Notification, Observable } from 'rxjs'; | ||
import { TestScheduler } from 'rxjs/testing'; | ||
import { getTestScheduler, initTestScheduler, resetTestScheduler, } from './src/scheduler'; | ||
@@ -44,2 +43,12 @@ import { TestColdObservable, TestHotObservable, } from './src/test-observables'; | ||
jasmine.addMatchers({ | ||
toHaveSubscriptions: function () { return ({ | ||
compare: function (actual, marbles) { | ||
var marblesArray = typeof marbles === 'string' ? [marbles] : marbles; | ||
var results = marblesArray.map(function (marbles) { | ||
return TestScheduler.parseMarblesAsSubscriptions(marbles); | ||
}); | ||
expect(results).toEqual(actual.getSubscriptions()); | ||
return { pass: true }; | ||
}, | ||
}); }, | ||
toBeObservable: function () { return ({ | ||
@@ -46,0 +55,0 @@ compare: function (actual, fixture) { |
@@ -1,4 +0,4 @@ | ||
import { TestScheduler } from 'rxjs/testing/TestScheduler'; | ||
import { TestScheduler } from 'rxjs/testing'; | ||
export declare function initTestScheduler(): void; | ||
export declare function getTestScheduler(): TestScheduler; | ||
export declare function resetTestScheduler(): void; |
@@ -1,2 +0,2 @@ | ||
import { TestScheduler } from 'rxjs/testing/TestScheduler'; | ||
import { TestScheduler } from 'rxjs/testing'; | ||
import { observableMatcher } from './matcher'; | ||
@@ -3,0 +3,0 @@ var scheduler; |
@@ -1,2 +0,3 @@ | ||
import { Observable } from 'rxjs/Observable'; | ||
import { Observable } from 'rxjs'; | ||
import { SubscriptionLog } from 'rxjs/internal/testing/SubscriptionLog'; | ||
export declare class TestColdObservable extends Observable<any> { | ||
@@ -7,2 +8,3 @@ marbles: string; | ||
constructor(marbles: string, values?: any[] | undefined, error?: any); | ||
getSubscriptions(): SubscriptionLog[]; | ||
} | ||
@@ -14,3 +16,4 @@ export declare class TestHotObservable extends Observable<any> { | ||
constructor(marbles: string, values?: any[] | undefined, error?: any); | ||
getSubscriptions(): SubscriptionLog[]; | ||
} | ||
export declare type TestObservable = TestColdObservable | TestHotObservable; |
@@ -11,5 +11,5 @@ var __extends = (this && this.__extends) || (function () { | ||
})(); | ||
import { Observable } from 'rxjs/Observable'; | ||
import { Observable } from 'rxjs'; | ||
import { getTestScheduler } from './scheduler'; | ||
var TestColdObservable = (function (_super) { | ||
var TestColdObservable = /** @class */ (function (_super) { | ||
__extends(TestColdObservable, _super); | ||
@@ -24,6 +24,9 @@ function TestColdObservable(marbles, values, error) { | ||
} | ||
TestColdObservable.prototype.getSubscriptions = function () { | ||
return this.source['subscriptions']; | ||
}; | ||
return TestColdObservable; | ||
}(Observable)); | ||
export { TestColdObservable }; | ||
var TestHotObservable = (function (_super) { | ||
var TestHotObservable = /** @class */ (function (_super) { | ||
__extends(TestHotObservable, _super); | ||
@@ -38,2 +41,5 @@ function TestHotObservable(marbles, values, error) { | ||
} | ||
TestHotObservable.prototype.getSubscriptions = function () { | ||
return this.source['subscriptions']; | ||
}; | ||
return TestHotObservable; | ||
@@ -40,0 +46,0 @@ }(Observable)); |
@@ -10,2 +10,3 @@ import { TestColdObservable, TestHotObservable } from './src/test-observables'; | ||
toBeObservable: any; | ||
toHaveSubscriptions: any; | ||
} | ||
@@ -12,0 +13,0 @@ } |
31
index.js
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Notification_1 = require("rxjs/Notification"); | ||
var Observable_1 = require("rxjs/Observable"); | ||
var TestScheduler_1 = require("rxjs/testing/TestScheduler"); | ||
var rxjs_1 = require("rxjs"); | ||
var testing_1 = require("rxjs/testing"); | ||
var scheduler_1 = require("./src/scheduler"); | ||
@@ -35,3 +34,3 @@ var test_observables_1 = require("./src/test-observables"); | ||
frame: scheduler.frame - outerFrame, | ||
notification: Notification_1.Notification.createNext(value), | ||
notification: rxjs_1.Notification.createNext(value), | ||
}); | ||
@@ -41,3 +40,3 @@ }, function (err) { | ||
frame: scheduler.frame - outerFrame, | ||
notification: Notification_1.Notification.createError(err), | ||
notification: rxjs_1.Notification.createError(err), | ||
}); | ||
@@ -47,3 +46,3 @@ }, function () { | ||
frame: scheduler.frame - outerFrame, | ||
notification: Notification_1.Notification.createComplete(), | ||
notification: rxjs_1.Notification.createComplete(), | ||
}); | ||
@@ -55,2 +54,12 @@ }); | ||
jasmine.addMatchers({ | ||
toHaveSubscriptions: function () { return ({ | ||
compare: function (actual, marbles) { | ||
var marblesArray = typeof marbles === 'string' ? [marbles] : marbles; | ||
var results = marblesArray.map(function (marbles) { | ||
return testing_1.TestScheduler.parseMarblesAsSubscriptions(marbles); | ||
}); | ||
expect(results).toEqual(actual.getSubscriptions()); | ||
return { pass: true }; | ||
}, | ||
}); }, | ||
toBeObservable: function () { return ({ | ||
@@ -65,3 +74,3 @@ compare: function (actual, fixture) { | ||
// Support Observable-of-Observables | ||
if (x instanceof Observable_1.Observable) { | ||
if (x instanceof rxjs_1.Observable) { | ||
value = materializeInnerObservable(value, scheduler.frame); | ||
@@ -71,3 +80,3 @@ } | ||
frame: scheduler.frame, | ||
notification: Notification_1.Notification.createNext(value), | ||
notification: rxjs_1.Notification.createNext(value), | ||
}); | ||
@@ -77,3 +86,3 @@ }, function (err) { | ||
frame: scheduler.frame, | ||
notification: Notification_1.Notification.createError(err), | ||
notification: rxjs_1.Notification.createError(err), | ||
}); | ||
@@ -83,3 +92,3 @@ }, function () { | ||
frame: scheduler.frame, | ||
notification: Notification_1.Notification.createComplete(), | ||
notification: rxjs_1.Notification.createComplete(), | ||
}); | ||
@@ -89,3 +98,3 @@ }); | ||
scheduler.flush(); | ||
var expected = TestScheduler_1.TestScheduler.parseMarbles(fixture.marbles, fixture.values, fixture.error, true); | ||
var expected = testing_1.TestScheduler.parseMarbles(fixture.marbles, fixture.values, fixture.error, true); | ||
expect(results).toEqual(expected); | ||
@@ -92,0 +101,0 @@ return { pass: true }; |
{ | ||
"name": "jasmine-marbles", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"module": "index.js", | ||
@@ -34,8 +34,9 @@ "es2015": "es6/index.js", | ||
"devDependencies": { | ||
"@types/jasmine": "^2.5.53", | ||
"@types/jasmine": "^2.8.0", | ||
"@types/lodash": "^4.14.106", | ||
"@types/node": "^8.0.14", | ||
"cpy-cli": "^1.0.1", | ||
"husky": "^0.14.3", | ||
"jasmine": "^2.5.3", | ||
"jasmine-core": "~2.5.2", | ||
"jasmine": "^2.8.0", | ||
"jasmine-core": "^2.8.0", | ||
"nyc": "^10.1.2", | ||
@@ -45,3 +46,3 @@ "prettier": "^1.5.2", | ||
"rollup": "^0.41.4", | ||
"rxjs": "^5.4.2", | ||
"rxjs": "^6.0.0-beta.1", | ||
"ts-node": "^3.1.0", | ||
@@ -51,3 +52,3 @@ "typescript": "^2.4.1" | ||
"peerDependencies": { | ||
"rxjs": "^5.0.0" | ||
"rxjs": "^6.0.0-beta.1" | ||
}, | ||
@@ -54,0 +55,0 @@ "dependencies": { |
# jasmine-marbles | ||
Marble testing helpers for RxJS and Jasmine | ||
Helpful Links | ||
* [Marble Syntax](https://github.com/ReactiveX/rxjs/blob/master/doc/writing-marble-tests.md "ReactiveX Documentation") | ||
* [Providing Mock Actions for testing ngrx Actions with jasmine-marbles](https://github.com/ngrx/platform/blob/master/docs/effects/testing.md "ngrx Documentation") |
@@ -1,4 +0,4 @@ | ||
import { TestScheduler } from 'rxjs/testing/TestScheduler'; | ||
import { TestScheduler } from 'rxjs/testing'; | ||
export declare function initTestScheduler(): void; | ||
export declare function getTestScheduler(): TestScheduler; | ||
export declare function resetTestScheduler(): void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var TestScheduler_1 = require("rxjs/testing/TestScheduler"); | ||
var testing_1 = require("rxjs/testing"); | ||
var matcher_1 = require("./matcher"); | ||
var scheduler; | ||
function initTestScheduler() { | ||
scheduler = new TestScheduler_1.TestScheduler(matcher_1.observableMatcher); | ||
scheduler = new testing_1.TestScheduler(matcher_1.observableMatcher); | ||
} | ||
@@ -9,0 +9,0 @@ exports.initTestScheduler = initTestScheduler; |
@@ -1,2 +0,3 @@ | ||
import { Observable } from 'rxjs/Observable'; | ||
import { Observable } from 'rxjs'; | ||
import { SubscriptionLog } from 'rxjs/internal/testing/SubscriptionLog'; | ||
export declare class TestColdObservable extends Observable<any> { | ||
@@ -7,2 +8,3 @@ marbles: string; | ||
constructor(marbles: string, values?: any[] | undefined, error?: any); | ||
getSubscriptions(): SubscriptionLog[]; | ||
} | ||
@@ -14,3 +16,4 @@ export declare class TestHotObservable extends Observable<any> { | ||
constructor(marbles: string, values?: any[] | undefined, error?: any); | ||
getSubscriptions(): SubscriptionLog[]; | ||
} | ||
export declare type TestObservable = TestColdObservable | TestHotObservable; |
@@ -13,5 +13,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Observable_1 = require("rxjs/Observable"); | ||
var rxjs_1 = require("rxjs"); | ||
var scheduler_1 = require("./scheduler"); | ||
var TestColdObservable = (function (_super) { | ||
var TestColdObservable = /** @class */ (function (_super) { | ||
__extends(TestColdObservable, _super); | ||
@@ -26,6 +26,9 @@ function TestColdObservable(marbles, values, error) { | ||
} | ||
TestColdObservable.prototype.getSubscriptions = function () { | ||
return this.source['subscriptions']; | ||
}; | ||
return TestColdObservable; | ||
}(Observable_1.Observable)); | ||
}(rxjs_1.Observable)); | ||
exports.TestColdObservable = TestColdObservable; | ||
var TestHotObservable = (function (_super) { | ||
var TestHotObservable = /** @class */ (function (_super) { | ||
__extends(TestHotObservable, _super); | ||
@@ -40,5 +43,8 @@ function TestHotObservable(marbles, values, error) { | ||
} | ||
TestHotObservable.prototype.getSubscriptions = function () { | ||
return this.source['subscriptions']; | ||
}; | ||
return TestHotObservable; | ||
}(Observable_1.Observable)); | ||
}(rxjs_1.Observable)); | ||
exports.TestHotObservable = TestHotObservable; | ||
//# sourceMappingURL=test-observables.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
114263
1212
9
0
14