<commit_before>describe 'Twinky', ->
  it 'should be defined', ->
    expect(Twinky).toBeDefined()

  it 'should have a send method', ->
    expect(Twinky.send).toBeDefined()

  it 'should have a endpoint method', ->
    expect(Twinky.endpoint).toBeDefined()

describe 'send', ->
  server = null

  beforeEach ->
    server = sinon.fakeServer.create()
    server.autoRespond = true
    Twinky.endpoint( 'http://stats.example.com/db/big-metric/series' )

  afterEach ->
    server.restore()

  it 'should send a request', ->
    Twinky.send()

    expect(server.requests.length).toBe(1)

  it 'sends the correct datapoints', ->
    window.performance = { timing: { navigationStart: 10000000, domInteractive: 10000777, domLoading: 10000333 } }
    Twinky.send({page: 'foo', version: '789f0'})

    expect(server.requests[0].requestBody).toEqual(JSON.stringify([
        { "name":"domLoading","columns":["value","page","version"],"points":[[333,"foo",'789f0']] },
        { "name":"domInteractive","columns":["value","page","version"],"points":[[444,"foo",'789f0']] },
    ]))

<commit_msg>better format for data in test<commit_after>describe 'Twinky', ->
  it 'should be defined', ->
    expect(Twinky).toBeDefined()

  it 'should have a send method', ->
    expect(Twinky.send).toBeDefined()

  it 'should have a endpoint method', ->
    expect(Twinky.endpoint).toBeDefined()

describe 'send', ->
  server = null

  beforeEach ->
    server = sinon.fakeServer.create()
    server.autoRespond = true
    Twinky.endpoint( 'http://stats.example.com/db/big-metric/series' )

  afterEach ->
    server.restore()

  it 'should send a request', ->
    Twinky.send()

    expect(server.requests.length).toBe(1)

  it 'sends the correct datapoints', ->
    window.performance = { timing: { navigationStart: 10000000, domInteractive: 10000777, domLoading: 10000333 } }
    Twinky.send({page: 'foo', version: '789f0'})

    expect(server.requests[0].requestBody).toEqual(
        JSON.stringify(
            [
                {
                    "name": "domLoading",
                    "columns": ["value","page","version"],
                    "points": [[333,"foo",'789f0']]
                },
                {
                    "name": "domInteractive",
                    "columns": ["value","page","version"],
                    "points": [[444,"foo",'789f0']]
                },
            ]
        )
    )


{'fraction_non_alphanumeric': 0.1690841276419395, 'fraction_numerical': 0.036469125569830084, 'mean_word_length': 2.6686930091185412, 'pattern_counts': {'":': 12, '<': 3, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '7356159', 'n_tokens_mistral': 831, 'n_tokens_neox': 723, 'n_words': 138}