<commit_before>/* globals describe, it, expect, expectObservable, hot */
var Rx = require('../../dist/cjs/Rx');
var Observable = Rx.Observable;

describe('Observable.prototype.skipUntil()', function () {
  it('should skip values until another observable notifies', function () {
    var e1 =     hot('--a--b--c--d--e--|');
    var skip =   hot('-------------x--|');
    var expected =  ('--------------e--|');

    expectObservable(e1.skipUntil(skip)).toBe(expected);
  });

  it('should emit element only after another observable emits', function () {
    var e1 =     hot('--a--b--c--d--e--|');
    var skip =   hot('-----------x----|');
    var expected =  ('--------------e--|');

    expectObservable(e1.skipUntil(skip)).toBe(expected);
  });

  it('should skip value and raises error until another observable raises error', function () {
    var e1 =   hot('--a--b--c--d--e--|');
    var skip = hot('-------------#');
    var expected = '-------------#';

    expectObservable(e1.skipUntil(skip)).toBe(expected);
  });

  it('should skip all element when another observable does not emit and completes early', function () {
    var e1 =   hot('--a--b--c--d--e--|');
    var skip = hot('------------|');
    var expected = '-----------------|';

    expectObservable(e1.skipUntil(skip)).toBe(expected);
  });

  it('should skip all element when another observable is empty', function () {
    var e1 =   hot('--a--b--c--d--e--|');
    var skip = Observable.empty();
    var expected = '-----------------|';

    expectObservable(e1.skipUntil(skip)).toBe(expected);
  });

  it('should not complete if source observable does not complete', function () {
    var e1 =   hot('-');
    var skip = hot('-------------x--|');
    var expected = '-';

    expectObservable(e1.skipUntil(skip)).toBe(expected);
  });

  it('should not complete if source observable never completes', function () {
    var e1 = Observable.never();
    var skip = hot('-------------x--|');
    var expected = '-';

    expectObservable(e1.skipUntil(skip)).toBe(expected);
  });

  it('should raise error if source does not completes when another observable raises error', function () {
    var e1 =   hot('-');
    var skip = hot('-------------#');
    var expected = '-------------#';

    expectObservable(e1.skipUntil(skip)).toBe(expected);
  });

  it('should raise error if source never completes when another observable raises error', function () {
    var e1 = Observable.never();
    var skip = hot('-------------#');
    var expected = '-------------#';

    expectObservable(e1.skipUntil(skip)).toBe(expected);
  });

  it('should skip all element and does not complete when another observable never completes', function () {
    var e1 =   hot('--a--b--c--d--e--|');
    var skip = Observable.never();
    var expected = '-';

    expectObservable(e1.skipUntil(skip)).toBe(expected);
  });

  it('should skip all element and does not complete when another observable does not completes', function () {
    var e1 =   hot('--a--b--c--d--e--|');
    var skip = hot('-');
    var expected = '-';

    expectObservable(e1.skipUntil(skip)).toBe(expected);
  });

  it('should skip all element and does not complete when another observable completes after source', function () {
    var e1 =   hot('--a--b--c--d--e--|');
    var skip = hot('------------------------|');
    var expected = '-';

    expectObservable(e1.skipUntil(skip)).toBe(expected);
  });

  it('should not completes if source does not completes when another observable does not emit', function () {
    var e1 =   hot('-');
    var skip = hot('--------------|');
    var expected = '-';

    expectObservable(e1.skipUntil(skip)).toBe(expected);
  });

  it('should not completes if source and another observable both does not complete', function () {
    var e1 =   hot('-');
    var skip = hot('-');
    var expected = '-';

    expectObservable(e1.skipUntil(skip)).toBe(expected);
  });

  it('should skip all element when another observable unsubscribed early before emit', function () {
    var e1 =   hot('--a--b--c--d--e--|');
    var skip = hot('-------------x--|');
    var expected = '-';

    e1.subscribe(function () {
      skip.unsubscribe();
    });

    expectObservable(e1.skipUntil(skip)).toBe(expected);
  });
});<commit_msg>test(skipUntil): assert subscription/unsubscription<commit_after>/* globals describe, it, expect, expectObservable, hot */
var Rx = require('../../dist/cjs/Rx');
var Observable = Rx.Observable;

describe('Observable.prototype.skipUntil()', function () {
  it('should skip values until another observable notifies', function () {
    var e1 =     hot('--a--b--c--d--e----|');
    var e1subs =     '^                  !';
    var skip =   hot('-------------x--|   ');
    var skipSubs =   '^               !   ';
    var expected =  ('--------------e----|');

    expectObservable(e1.skipUntil(skip)).toBe(expected);
    expectSubscriptions(e1.subscriptions).toBe(e1subs);
    expectSubscriptions(skip.subscriptions).toBe(skipSubs);
  });

  it('should emit element only after another observable emits', function () {
    var e1 =     hot('--a--b--c--d--e--|');
    var e1subs =     '^                !';
    var skip =   hot('-----------x----| ');
    var skipSubs =   '^               ! ';
    var expected =  ('--------------e--|');

    expectObservable(e1.skipUntil(skip)).toBe(expected);
    expectSubscriptions(e1.subscriptions).toBe(e1subs);
    expectSubscriptions(skip.subscriptions).toBe(skipSubs);
  });

  it('should skip value and raises error until another observable raises error', function () {
    var e1 =   hot('--a--b--c--d--e--|');
    var e1subs =   '^            !    ';
    var skip = hot('-------------#    ');
    var skipSubs = '^            !    ';
    var expected = '-------------#    ';

    expectObservable(e1.skipUntil(skip)).toBe(expected);
    expectSubscriptions(e1.subscriptions).toBe(e1subs);
    expectSubscriptions(skip.subscriptions).toBe(skipSubs);
  });

  it('should skip all element when another observable does not emit and completes early', function () {
    var e1 =   hot('--a--b--c--d--e--|');
    var e1subs =   '^                !';
    var skip = hot('------------|     ');
    var skipSubs = '^           !     ';
    var expected = '-----------------|';

    expectObservable(e1.skipUntil(skip)).toBe(expected);
    expectSubscriptions(e1.subscriptions).toBe(e1subs);
    expectSubscriptions(skip.subscriptions).toBe(skipSubs);
  });

  it('should skip all element when another observable is empty', function () {
    var e1 =   hot('--a--b--c--d--e--|');
    var e1subs =   '^                !';
    var skip = cold('|');
    var skipSubs = '(^!)';
    var expected = '-----------------|';

    expectObservable(e1.skipUntil(skip)).toBe(expected);
    expectSubscriptions(e1.subscriptions).toBe(e1subs);
    expectSubscriptions(skip.subscriptions).toBe(skipSubs);
  });

  it('should keep subscription to source, to wait for its eventual complete', function () {
    var e1 =   hot('------------------------------|');
    var e1subs =   '^                             !';
    var skip = hot('-------|                       ');
    var skipSubs = '^      !                       ';
    var expected = '------------------------------|';

    expectObservable(e1.skipUntil(skip)).toBe(expected);
    expectSubscriptions(e1.subscriptions).toBe(e1subs);
    expectSubscriptions(skip.subscriptions).toBe(skipSubs);
  });

  it('should not complete if source observable does not complete', function () {
    var e1 =   hot('-');
    var e1subs =   '^';
    var skip = hot('-------------x--|');
    var skipSubs = '^               !';
    var expected = '-';

    expectObservable(e1.skipUntil(skip)).toBe(expected);
    expectSubscriptions(e1.subscriptions).toBe(e1subs);
    expectSubscriptions(skip.subscriptions).toBe(skipSubs);
  });

  it('should not complete if source observable never completes', function () {
    var e1 = cold( '-');
    var e1subs =   '^';
    var skip = hot('-------------x--|');
    var skipSubs = '^               !';
    var expected = '-';

    expectObservable(e1.skipUntil(skip)).toBe(expected);
    expectSubscriptions(e1.subscriptions).toBe(e1subs);
    expectSubscriptions(skip.subscriptions).toBe(skipSubs);
  });

  it('should raise error if source does not completes when another observable raises error', function () {
    var e1 =   hot('-');
    var e1subs =   '^            !';
    var skip = hot('-------------#');
    var skipSubs = '^            !';
    var expected = '-------------#';

    expectObservable(e1.skipUntil(skip)).toBe(expected);
    expectSubscriptions(e1.subscriptions).toBe(e1subs);
    expectSubscriptions(skip.subscriptions).toBe(skipSubs);
  });

  it('should raise error if source never completes when another observable raises error', function () {
    var e1 = cold( '-');
    var e1subs =   '^            !';
    var skip = hot('-------------#');
    var skipSubs = '^            !';
    var expected = '-------------#';

    expectObservable(e1.skipUntil(skip)).toBe(expected);
    expectSubscriptions(e1.subscriptions).toBe(e1subs);
    expectSubscriptions(skip.subscriptions).toBe(skipSubs);
  });

  it('should skip all element and does not complete when another observable never completes', function () {
    var e1 =   hot( '--a--b--c--d--e--|');
    var e1subs =    '^                !';
    var skip = cold('-');
    var skipSubs =  '^                !';
    var expected =  '-';

    expectObservable(e1.skipUntil(skip)).toBe(expected);
    expectSubscriptions(e1.subscriptions).toBe(e1subs);
    expectSubscriptions(skip.subscriptions).toBe(skipSubs);
  });

  it('should skip all element and does not complete when another observable does not completes', function () {
    var e1 =   hot('--a--b--c--d--e--|');
    var e1subs =   '^                !';
    var skip = hot('-');
    var skipSubs = '^                !';
    var expected = '-';

    expectObservable(e1.skipUntil(skip)).toBe(expected);
    expectSubscriptions(e1.subscriptions).toBe(e1subs);
    expectSubscriptions(skip.subscriptions).toBe(skipSubs);
  });

  it('should skip all element and does not complete when another observable completes after source', function () {
    var e1 =   hot('--a--b--c--d--e--|');
    var e1subs =   '^                !';
    var skip = hot('------------------------|');
    var skipSubs = '^                !';
    var expected = '------------------';

    expectObservable(e1.skipUntil(skip)).toBe(expected);
    expectSubscriptions(e1.subscriptions).toBe(e1subs);
    expectSubscriptions(skip.subscriptions).toBe(skipSubs);
  });

  it('should not completes if source does not completes when another observable does not emit', function () {
    var e1 =   hot('-');
    var e1subs =   '^';
    var skip = hot('--------------|');
    var skipSubs = '^             !';
    var expected = '-';

    expectObservable(e1.skipUntil(skip)).toBe(expected);
    expectSubscriptions(e1.subscriptions).toBe(e1subs);
    expectSubscriptions(skip.subscriptions).toBe(skipSubs);
  });

  it('should not completes if source and another observable both does not complete', function () {
    var e1 =   hot('-');
    var e1subs =   '^';
    var skip = hot('-');
    var skipSubs = '^';
    var expected = '-';

    expectObservable(e1.skipUntil(skip)).toBe(expected);
    expectSubscriptions(e1.subscriptions).toBe(e1subs);
    expectSubscriptions(skip.subscriptions).toBe(skipSubs);
  });

  it('should skip all element when another observable unsubscribed early before emit', function () {
    var e1 =   hot( '--a--b--c--d--e--|');
    var e1subs =   ['^                !',
                    '^                !']; // for the explicit subscribe some lines below
    var skip = hot( '-------------x--|');
    var expected =  '-';

    e1.subscribe(function () {
      skip.unsubscribe();
    });

    expectObservable(e1.skipUntil(skip)).toBe(expected);
    expectSubscriptions(e1.subscriptions).toBe(e1subs);
  });
});
{'fraction_non_alphanumeric': 0.21123483463520026, 'fraction_numerical': 0.00930696360312448, 'mean_word_length': 2.2588681288924994, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2469151', 'n_tokens_mistral': 3676, 'n_tokens_neox': 3512, 'n_words': 800}