<commit_before>var Segment = require('../src/segment');
var fetchMock = require('fetch-mock');
var btoa = require('btoa');

function matchSegmentCall(actualData, expectedData) {
  expect(Object.keys(actualData)).toEqual(['method', 'headers', 'body']);

  var
    method = actualData.method,
    headers = actualData.headers,
    body = JSON.parse(actualData.body);

  expect(method).toEqual(expectedData.method);
  expect(headers).toEqual(expectedData.headers);
  expect(body).toEqual(expectedData.body);
}

describe('Segment', function(){
  var segment, key;
  var identifyUrl, trackUrl, pageUrl;<commit_msg>Custom object matcher in use<commit_after>var Segment = require('../src/segment');
var fetchMock = require('fetch-mock');
var btoa = require('btoa');
var toEqualObject = require('./support/toEqualObject.js');

function matchSegmentCall(actualData, expectedData) {
  expect(Object.keys(actualData)).toEqual(['method', 'headers', 'body']);

  var
    method = actualData.method,
    headers = actualData.headers,
    body = JSON.parse(actualData.body);

  expect(method).toEqual(expectedData.method);
  expect(headers).toEqualObject(expectedData.headers);
  expect(body).toEqualObject(expectedData.body);
}

beforeEach(function(){
  jasmine.addMatchers(toEqualObject);
})

describe('Segment', function(){
  var segment, key;
  var identifyUrl, trackUrl, pageUrl;
{'fraction_non_alphanumeric': 0.15339663988312638, 'fraction_numerical': 0.0, 'mean_word_length': 5.989795918367347, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2717456', 'n_tokens_mistral': 409, 'n_tokens_neox': 410, 'n_words': 76}