<commit_before>require('when/es6-shim/Promise')

describe "firstToPromise", ->
  it "picks the first event from Observable, later", ->
    Bacon.later(3, "foobar").firstToPromise().then (x) ->
      expect(x).to.equal("foobar")

  it "picks the first event from Observable, sequentially", ->
    Bacon.sequentially(3, [1, 2, 3]).firstToPromise().then (x) ->
      expect(x).to.equal(1)

  it.skip "never resolves with undefined from empty Observable", ->
    Bacon.sequentially(3, []).firstToPromise().then (x) ->
      expect(x).to.equal(undefined)

describe "toPromise", ->
  it "picks the last event from Observable, later", ->
    Bacon.later(3, "foobar").toPromise().then (x) ->
      expect(x).to.equal("foobar")

  it "picks the last event from Observable, sequentially", ->
    Bacon.sequentially(3, [1, 2, 3]).toPromise().then (x) ->
      expect(x).to.equal(3)

  it.skip "never resolves with undefined from empty Observable", ->
    Bacon.sequentially(3, []).toPromise().then (x) ->
      expect(x).to.equal(undefined)<commit_msg>fix test in case it's run alone with `./test topromise`<commit_after>require('when/es6-shim/Promise')

describe "firstToPromise", ->
  it "picks the first event from Observable, later", ->
    later(3, "foobar").firstToPromise().then (x) ->
      expect(x).to.equal("foobar")

  it "picks the first event from Observable, sequentially", ->
    sequentially(3, [1, 2, 3]).firstToPromise().then (x) ->
      expect(x).to.equal(1)

  it.skip "never resolves with undefined from empty Observable", ->
    sequentially(3, []).firstToPromise().then (x) ->
      expect(x).to.equal(undefined)

describe "toPromise", ->
  it "picks the last event from Observable, later", ->
    later(3, "foobar").toPromise().then (x) ->
      expect(x).to.equal("foobar")

  it "picks the last event from Observable, sequentially", ->
    sequentially(3, [1, 2, 3]).toPromise().then (x) ->
      expect(x).to.equal(3)

  it.skip "never resolves with undefined from empty Observable", ->
    sequentially(3, []).toPromise().then (x) ->
      expect(x).to.equal(undefined)
{'fraction_non_alphanumeric': 0.17576628352490423, 'fraction_numerical': 0.014367816091954023, 'mean_word_length': 3.6629464285714284, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5601177', 'n_tokens_mistral': 708, 'n_tokens_neox': 672, 'n_words': 170}