This commit is contained in:
tatianamac
2019-11-26 14:50:43 -08:00
parent 8a55660ed0
commit 6d5445ecc5
13894 changed files with 2233957 additions and 0 deletions

34
node_modules/rxjs/_esm2015/testing/ColdObservable.js generated vendored Normal file
View File

@@ -0,0 +1,34 @@
import { Observable } from '../Observable';
import { Subscription } from '../Subscription';
import { SubscriptionLoggable } from './SubscriptionLoggable';
import { applyMixins } from '../util/applyMixins';
/**
* We need this JSDoc comment for affecting ESDoc.
* @ignore
* @extends {Ignored}
*/
export class ColdObservable extends Observable {
constructor(messages, scheduler) {
super(function (subscriber) {
const observable = this;
const index = observable.logSubscribedFrame();
subscriber.add(new Subscription(() => {
observable.logUnsubscribedFrame(index);
}));
observable.scheduleMessages(subscriber);
return subscriber;
});
this.messages = messages;
this.subscriptions = [];
this.scheduler = scheduler;
}
scheduleMessages(subscriber) {
const messagesLength = this.messages.length;
for (let i = 0; i < messagesLength; i++) {
const message = this.messages[i];
subscriber.add(this.scheduler.schedule(({ message, subscriber }) => { message.notification.observe(subscriber); }, message.frame, { message, subscriber }));
}
}
}
applyMixins(ColdObservable, [SubscriptionLoggable]);
//# sourceMappingURL=ColdObservable.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ColdObservable.js","sourceRoot":"","sources":["../../src/testing/ColdObservable.ts"],"names":[],"mappings":"OAAO,EAAE,UAAU,EAAE,MAAM,eAAe;OACnC,EAAE,YAAY,EAAE,MAAM,iBAAiB;OAIvC,EAAE,oBAAoB,EAAE,MAAM,wBAAwB;OACtD,EAAE,WAAW,EAAE,MAAM,qBAAqB;AAGjD;;;;GAIG;AACH,oCAAuC,UAAU;IAM/C,YAAmB,QAAuB,EAC9B,SAAoB;QAC9B,MAAM,UAAmC,UAA2B;YAClE,MAAM,UAAU,GAAsB,IAAI,CAAC;YAC3C,MAAM,KAAK,GAAG,UAAU,CAAC,kBAAkB,EAAE,CAAC;YAC9C,UAAU,CAAC,GAAG,CAAC,IAAI,YAAY,CAAC;gBAC9B,UAAU,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;YACzC,CAAC,CAAC,CAAC,CAAC;YACJ,UAAU,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;YACxC,MAAM,CAAC,UAAU,CAAC;QACpB,CAAC,CAAC,CAAC;QAVc,aAAQ,GAAR,QAAQ,CAAe;QALnC,kBAAa,GAAsB,EAAE,CAAC;QAgB3C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED,gBAAgB,CAAC,UAA2B;QAC1C,MAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;QAC5C,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,EAAE,CAAC,EAAE,EAAE,CAAC;YACxC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YACjC,UAAU,CAAC,GAAG,CACZ,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC,OAAO,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAC9F,OAAO,CAAC,KAAK,EACb,EAAC,OAAO,EAAE,UAAU,EAAC,CAAC,CACzB,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC;AACD,WAAW,CAAC,cAAc,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC"}

39
node_modules/rxjs/_esm2015/testing/HotObservable.js generated vendored Normal file
View File

@@ -0,0 +1,39 @@
import { Subject } from '../Subject';
import { Subscription } from '../Subscription';
import { SubscriptionLoggable } from './SubscriptionLoggable';
import { applyMixins } from '../util/applyMixins';
/**
* We need this JSDoc comment for affecting ESDoc.
* @ignore
* @extends {Ignored}
*/
export class HotObservable extends Subject {
constructor(messages, scheduler) {
super();
this.messages = messages;
this.subscriptions = [];
this.scheduler = scheduler;
}
/** @deprecated internal use only */ _subscribe(subscriber) {
const subject = this;
const index = subject.logSubscribedFrame();
subscriber.add(new Subscription(() => {
subject.logUnsubscribedFrame(index);
}));
return super._subscribe(subscriber);
}
setup() {
const subject = this;
const messagesLength = subject.messages.length;
/* tslint:disable:no-var-keyword */
for (var i = 0; i < messagesLength; i++) {
(() => {
var message = subject.messages[i];
/* tslint:enable */
subject.scheduler.schedule(() => { message.notification.observe(subject); }, message.frame);
})();
}
}
}
applyMixins(HotObservable, [SubscriptionLoggable]);
//# sourceMappingURL=HotObservable.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"HotObservable.js","sourceRoot":"","sources":["../../src/testing/HotObservable.ts"],"names":[],"mappings":"OAAO,EAAE,OAAO,EAAE,MAAM,YAAY;OAE7B,EAAE,YAAY,EAAE,MAAM,iBAAiB;OAIvC,EAAE,oBAAoB,EAAE,MAAM,wBAAwB;OACtD,EAAE,WAAW,EAAE,MAAM,qBAAqB;AAEjD;;;;GAIG;AACH,mCAAsC,OAAO;IAM3C,YAAmB,QAAuB,EAC9B,SAAoB;QAC9B,OAAO,CAAC;QAFS,aAAQ,GAAR,QAAQ,CAAe;QALnC,kBAAa,GAAsB,EAAE,CAAC;QAQ3C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED,oCAAoC,CAAC,UAAU,CAAC,UAA2B;QACzE,MAAM,OAAO,GAAqB,IAAI,CAAC;QACvC,MAAM,KAAK,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;QAC3C,UAAU,CAAC,GAAG,CAAC,IAAI,YAAY,CAAC;YAC9B,OAAO,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC,CAAC;QACJ,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC;IAED,KAAK;QACH,MAAM,OAAO,GAAG,IAAI,CAAC;QACrB,MAAM,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;QAC/C,mCAAmC;QACnC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,EAAE,CAAC,EAAE,EAAE,CAAC;YACxC,CAAC;gBACC,IAAI,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;gBACvC,mBAAmB;gBACd,OAAO,CAAC,SAAS,CAAC,QAAQ,CACxB,QAAQ,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAChD,OAAO,CAAC,KAAK,CACd,CAAC;YACJ,CAAC,CAAC,EAAE,CAAC;QACP,CAAC;IACH,CAAC;AACH,CAAC;AACD,WAAW,CAAC,aAAa,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC"}

View File

@@ -0,0 +1,7 @@
export class SubscriptionLog {
constructor(subscribedFrame, unsubscribedFrame = Number.POSITIVE_INFINITY) {
this.subscribedFrame = subscribedFrame;
this.unsubscribedFrame = unsubscribedFrame;
}
}
//# sourceMappingURL=SubscriptionLog.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"SubscriptionLog.js","sourceRoot":"","sources":["../../src/testing/SubscriptionLog.ts"],"names":[],"mappings":"AAAA;IACE,YAAmB,eAAuB,EACvB,iBAAiB,GAAW,MAAM,CAAC,iBAAiB;QADpD,oBAAe,GAAf,eAAe,CAAQ;QACvB,sBAAiB,GAAjB,iBAAiB,CAAmC;IACvE,CAAC;AACH,CAAC;AAAA"}

View File

@@ -0,0 +1,16 @@
import { SubscriptionLog } from './SubscriptionLog';
export class SubscriptionLoggable {
constructor() {
this.subscriptions = [];
}
logSubscribedFrame() {
this.subscriptions.push(new SubscriptionLog(this.scheduler.now()));
return this.subscriptions.length - 1;
}
logUnsubscribedFrame(index) {
const subscriptionLogs = this.subscriptions;
const oldSubscriptionLog = subscriptionLogs[index];
subscriptionLogs[index] = new SubscriptionLog(oldSubscriptionLog.subscribedFrame, this.scheduler.now());
}
}
//# sourceMappingURL=SubscriptionLoggable.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"SubscriptionLoggable.js","sourceRoot":"","sources":["../../src/testing/SubscriptionLoggable.ts"],"names":[],"mappings":"OACO,EAAE,eAAe,EAAE,MAAM,mBAAmB;AAEnD;IAAA;QACS,kBAAa,GAAsB,EAAE,CAAC;IAgB/C,CAAC;IAbC,kBAAkB;QAChB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACnE,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;IACvC,CAAC;IAED,oBAAoB,CAAC,KAAa;QAChC,MAAM,gBAAgB,GAAG,IAAI,CAAC,aAAa,CAAC;QAC5C,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;QACnD,gBAAgB,CAAC,KAAK,CAAC,GAAG,IAAI,eAAe,CAC3C,kBAAkB,CAAC,eAAe,EAClC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CACrB,CAAC;IACJ,CAAC;AACH,CAAC;AAAA"}

1
node_modules/rxjs/_esm2015/testing/TestMessage.js generated vendored Normal file
View File

@@ -0,0 +1 @@
//# sourceMappingURL=TestMessage.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"TestMessage.js","sourceRoot":"","sources":["../../src/testing/TestMessage.ts"],"names":[],"mappings":""}

208
node_modules/rxjs/_esm2015/testing/TestScheduler.js generated vendored Normal file
View File

@@ -0,0 +1,208 @@
import { Observable } from '../Observable';
import { Notification } from '../Notification';
import { ColdObservable } from './ColdObservable';
import { HotObservable } from './HotObservable';
import { SubscriptionLog } from './SubscriptionLog';
import { VirtualTimeScheduler, VirtualAction } from '../scheduler/VirtualTimeScheduler';
const defaultMaxFrame = 750;
export class TestScheduler extends VirtualTimeScheduler {
constructor(assertDeepEqual) {
super(VirtualAction, defaultMaxFrame);
this.assertDeepEqual = assertDeepEqual;
this.hotObservables = [];
this.coldObservables = [];
this.flushTests = [];
}
createTime(marbles) {
const indexOf = marbles.indexOf('|');
if (indexOf === -1) {
throw new Error('marble diagram for time should have a completion marker "|"');
}
return indexOf * TestScheduler.frameTimeFactor;
}
createColdObservable(marbles, values, error) {
if (marbles.indexOf('^') !== -1) {
throw new Error('cold observable cannot have subscription offset "^"');
}
if (marbles.indexOf('!') !== -1) {
throw new Error('cold observable cannot have unsubscription marker "!"');
}
const messages = TestScheduler.parseMarbles(marbles, values, error);
const cold = new ColdObservable(messages, this);
this.coldObservables.push(cold);
return cold;
}
createHotObservable(marbles, values, error) {
if (marbles.indexOf('!') !== -1) {
throw new Error('hot observable cannot have unsubscription marker "!"');
}
const messages = TestScheduler.parseMarbles(marbles, values, error);
const subject = new HotObservable(messages, this);
this.hotObservables.push(subject);
return subject;
}
materializeInnerObservable(observable, outerFrame) {
const messages = [];
observable.subscribe((value) => {
messages.push({ frame: this.frame - outerFrame, notification: Notification.createNext(value) });
}, (err) => {
messages.push({ frame: this.frame - outerFrame, notification: Notification.createError(err) });
}, () => {
messages.push({ frame: this.frame - outerFrame, notification: Notification.createComplete() });
});
return messages;
}
expectObservable(observable, unsubscriptionMarbles = null) {
const actual = [];
const flushTest = { actual, ready: false };
const unsubscriptionFrame = TestScheduler
.parseMarblesAsSubscriptions(unsubscriptionMarbles).unsubscribedFrame;
let subscription;
this.schedule(() => {
subscription = observable.subscribe(x => {
let value = x;
// Support Observable-of-Observables
if (x instanceof Observable) {
value = this.materializeInnerObservable(value, this.frame);
}
actual.push({ frame: this.frame, notification: Notification.createNext(value) });
}, (err) => {
actual.push({ frame: this.frame, notification: Notification.createError(err) });
}, () => {
actual.push({ frame: this.frame, notification: Notification.createComplete() });
});
}, 0);
if (unsubscriptionFrame !== Number.POSITIVE_INFINITY) {
this.schedule(() => subscription.unsubscribe(), unsubscriptionFrame);
}
this.flushTests.push(flushTest);
return {
toBe(marbles, values, errorValue) {
flushTest.ready = true;
flushTest.expected = TestScheduler.parseMarbles(marbles, values, errorValue, true);
}
};
}
expectSubscriptions(actualSubscriptionLogs) {
const flushTest = { actual: actualSubscriptionLogs, ready: false };
this.flushTests.push(flushTest);
return {
toBe(marbles) {
const marblesArray = (typeof marbles === 'string') ? [marbles] : marbles;
flushTest.ready = true;
flushTest.expected = marblesArray.map(marbles => TestScheduler.parseMarblesAsSubscriptions(marbles));
}
};
}
flush() {
const hotObservables = this.hotObservables;
while (hotObservables.length > 0) {
hotObservables.shift().setup();
}
super.flush();
const readyFlushTests = this.flushTests.filter(test => test.ready);
while (readyFlushTests.length > 0) {
const test = readyFlushTests.shift();
this.assertDeepEqual(test.actual, test.expected);
}
}
static parseMarblesAsSubscriptions(marbles) {
if (typeof marbles !== 'string') {
return new SubscriptionLog(Number.POSITIVE_INFINITY);
}
const len = marbles.length;
let groupStart = -1;
let subscriptionFrame = Number.POSITIVE_INFINITY;
let unsubscriptionFrame = Number.POSITIVE_INFINITY;
for (let i = 0; i < len; i++) {
const frame = i * this.frameTimeFactor;
const c = marbles[i];
switch (c) {
case '-':
case ' ':
break;
case '(':
groupStart = frame;
break;
case ')':
groupStart = -1;
break;
case '^':
if (subscriptionFrame !== Number.POSITIVE_INFINITY) {
throw new Error('found a second subscription point \'^\' in a ' +
'subscription marble diagram. There can only be one.');
}
subscriptionFrame = groupStart > -1 ? groupStart : frame;
break;
case '!':
if (unsubscriptionFrame !== Number.POSITIVE_INFINITY) {
throw new Error('found a second subscription point \'^\' in a ' +
'subscription marble diagram. There can only be one.');
}
unsubscriptionFrame = groupStart > -1 ? groupStart : frame;
break;
default:
throw new Error('there can only be \'^\' and \'!\' markers in a ' +
'subscription marble diagram. Found instead \'' + c + '\'.');
}
}
if (unsubscriptionFrame < 0) {
return new SubscriptionLog(subscriptionFrame);
}
else {
return new SubscriptionLog(subscriptionFrame, unsubscriptionFrame);
}
}
static parseMarbles(marbles, values, errorValue, materializeInnerObservables = false) {
if (marbles.indexOf('!') !== -1) {
throw new Error('conventional marble diagrams cannot have the ' +
'unsubscription marker "!"');
}
const len = marbles.length;
const testMessages = [];
const subIndex = marbles.indexOf('^');
const frameOffset = subIndex === -1 ? 0 : (subIndex * -this.frameTimeFactor);
const getValue = typeof values !== 'object' ?
(x) => x :
(x) => {
// Support Observable-of-Observables
if (materializeInnerObservables && values[x] instanceof ColdObservable) {
return values[x].messages;
}
return values[x];
};
let groupStart = -1;
for (let i = 0; i < len; i++) {
const frame = i * this.frameTimeFactor + frameOffset;
let notification;
const c = marbles[i];
switch (c) {
case '-':
case ' ':
break;
case '(':
groupStart = frame;
break;
case ')':
groupStart = -1;
break;
case '|':
notification = Notification.createComplete();
break;
case '^':
break;
case '#':
notification = Notification.createError(errorValue || 'error');
break;
default:
notification = Notification.createNext(getValue(c));
break;
}
if (notification) {
testMessages.push({ frame: groupStart > -1 ? groupStart : frame, notification });
}
}
return testMessages;
}
}
//# sourceMappingURL=TestScheduler.js.map

File diff suppressed because one or more lines are too long