<commit_before>expect = require("chai").expect
Bacon = require "baconjs"
bjb = require "../src/Bacon.JQuery.Bindings"
twice = (x) -> x * 2

grep = process.env.grep
if grep
  console.log("running with grep:", grep)
  origDescribe = describe
  global.describe = (desc, f) ->
    if desc.indexOf(grep) >= 0
      origDescribe(desc, f)

describe "Model.set", ->
  it "sets new value", ->
    b = bjb.Model()
    values = collect(b)
    b.set("wat")
    expect(values).to.deep.equal(["wat"])

describe "Model initial value", ->
  it "is sent", ->
    cylinders = bjb.Model(12)
    expect(collect(cylinders)).to.deep.equal([12])
  it "can be omitted", ->
    cylinders = bjb.Model()
    expect(collect(cylinders)).to.deep.equal([])

describe "Model.modify", ->
  it "modifies current value with given function", ->
    b = bjb.Model(1)
    values = collect(b)
    b.modify(twice)
    b.modify(twice)
    expect(values).to.deep.equal([1, 2, 4])

describe "Model.apply", ->
  it "Applies given stream of functions to the Model", ->
    b = bjb.Model(1)
    values = collect(b)
    b.apply(Bacon.fromArray([twice, twice, twice]))
    expect(values).to.deep.equal([1, 2, 4, 8])

describe "Model.addSource", ->
  it "connects new input stream", ->
    b = bjb.Model()<commit_msg>test Model.set with to consecutive "set" calls<commit_after>expect = require("chai").expect
Bacon = require "baconjs"
bjb = require "../src/Bacon.JQuery.Bindings"
twice = (x) -> x * 2

grep = process.env.grep
if grep
  console.log("running with grep:", grep)
  origDescribe = describe
  global.describe = (desc, f) ->
    if desc.indexOf(grep) >= 0
      origDescribe(desc, f)

describe "Model.set", ->
  it "sets new value", ->
    b = bjb.Model()
    values = collect(b)
    b.set("wat")
    b.set("asdf")
    expect(values).to.deep.equal(["wat", "asdf"])

describe "Model initial value", ->
  it "is sent", ->
    cylinders = bjb.Model(12)
    expect(collect(cylinders)).to.deep.equal([12])
  it "can be omitted", ->
    cylinders = bjb.Model()
    expect(collect(cylinders)).to.deep.equal([])

describe "Model.modify", ->
  it "modifies current value with given function", ->
    b = bjb.Model(1)
    values = collect(b)
    b.modify(twice)
    b.modify(twice)
    expect(values).to.deep.equal([1, 2, 4])

describe "Model.apply", ->
  it "Applies given stream of functions to the Model", ->
    b = bjb.Model(1)
    values = collect(b)
    b.apply(Bacon.fromArray([twice, twice, twice]))
    expect(values).to.deep.equal([1, 2, 4, 8])

describe "Model.addSource", ->
  it "connects new input stream", ->
    b = bjb.Model()
{'fraction_non_alphanumeric': 0.17533718689788053, 'fraction_numerical': 0.011560693641618497, 'mean_word_length': 3.2349102773246328, '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': '2634712', 'n_tokens_mistral': 992, 'n_tokens_neox': 935, 'n_words': 223}