Skip to content
This repository has been archived by the owner on Feb 7, 2022. It is now read-only.

Commit

Permalink
Merge pull request #7 from GlobalWebIndex/chore/use_object_matcher
Browse files Browse the repository at this point in the history
Custom object matcher in use
  • Loading branch information
renra committed Mar 30, 2017
2 parents 09514b7 + b892cad commit f11c2ae
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions spec/segment_spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
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']);
Expand All @@ -11,10 +12,14 @@ function matchSegmentCall(actualData, expectedData) {
body = JSON.parse(actualData.body);

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

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

describe('Segment', function(){
var segment, key;
var identifyUrl, trackUrl, pageUrl;
Expand Down

0 comments on commit f11c2ae

Please sign in to comment.