   it "combines properties by applying the combinator function to values", ->
     expectPropertyEvents(
       ->
-        stream = repeat(1, [[1]]).take(1)
+        stream = series(1, [[1]])
         Bacon.combineWith([stream, Bacon.constant([2]), Bacon.constant([3])], ".concat")
       [[1, 2, 3]])
 

  it "samples property by given interval", ->
    expectStreamEvents(
      ->
        prop = repeat(2, [1, 2]).take(2).toProperty()
        prop.sample(t(3)).take(4)
      [1, 2, 2, 2])
  it "includes all errors", ->
    expectStreamEvents(
      ->
        prop = repeat(2, [1, error(), 2]).take(2).toProperty()
        prop.sample(t(5)).take(2)
      [error(), 1, 2])


describe "EventStream.skip", ->
  it "should skip first N items", ->
    expectStreamEvents(
      -> series(1, [1, error(), 2, error(), 3]).skip(1)
    [error(), 2, error(), 3])

describe "EventStream.skipDuplicates", ->
  it "drops duplicates", ->
    expectStreamEvents(
      -> series(1, [1, 2, error(), 2, 3, 1]).skipDuplicates()
    [1, 2, error(), 3, 1])

describe "EventStream.flatMap", ->
  it "should spawn new stream for each value and collect results into a single stream", ->
    expectStreamEvents(
      -> series(1, [1, 2]).flatMap (value) ->
        Bacon.sequentially(t(10), [value, error(), value])
      [1, 2, error(), error(), 1, 2])
  it "should pass source errors through to the result", ->
    expectStreamEvents(
      -> series(1, [error(), 1]).flatMap (value) ->
        Bacon.later(t(1), value)
      [error(), 1])

describe "EventStream.switch", ->
  it "spawns new streams but collects values from the latest spawned stream only", ->
    expectStreamEvents(
      -> series(3, [1, 2]).switch (value) ->
        Bacon.sequentially(t(2), [value, error(), value])
      [1, 2, error(), 2])

