Skip to content

Commit

Permalink
fix orbidder pathing and test (prebid#3451)
Browse files Browse the repository at this point in the history
  • Loading branch information
snapwich authored and Pedro López Jiménez committed Mar 18, 2019
1 parent d75b0b0 commit cadee22
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
12 changes: 8 additions & 4 deletions modules/orbidderBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {detectReferer} from 'src/refererDetection';
import {ajax} from 'src/ajax';
import {registerBidder} from 'src/adapters/bidderFactory';
import {detectReferer} from '../src/refererDetection';
import {ajax} from '../src/ajax';
import {registerBidder} from '../src/adapters/bidderFactory';

export const spec = {
code: 'orbidder',
Expand Down Expand Up @@ -70,7 +70,11 @@ export const spec = {
const getRefererInfo = detectReferer(window);
const refererInfo = getRefererInfo();
winObj.pageUrl = refererInfo.referer;
ajax(`${this.orbidderHost}/win`, null, JSON.stringify(winObj));
spec.ajaxCall(`${this.orbidderHost}/win`, JSON.stringify(winObj));
},

ajaxCall(endpoint, data) {
ajax(endpoint, null, data);
}
};

Expand Down
5 changes: 2 additions & 3 deletions test/spec/modules/orbidderBidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {expect} from 'chai';
import {spec} from 'modules/orbidderBidAdapter';
import {newBidder} from 'src/adapters/bidderFactory';
import * as ajax from 'src/ajax';

describe('orbidderBidAdapter', () => {
const adapter = newBidder(spec);
Expand Down Expand Up @@ -117,7 +116,7 @@ describe('orbidderBidAdapter', () => {
};

beforeEach(() => {
ajaxStub = sinon.stub(ajax, 'ajax');
ajaxStub = sinon.stub(spec, 'ajaxCall');
});

afterEach(() => {
Expand All @@ -129,7 +128,7 @@ describe('orbidderBidAdapter', () => {
expect(ajaxStub.calledOnce).to.equal(true);
expect(ajaxStub.firstCall.args[0].indexOf('https://')).to.equal(0);
expect(ajaxStub.firstCall.args[0]).to.equal(`${spec.orbidderHost}/win`);
expect(ajaxStub.firstCall.args[2]).to.equal(JSON.stringify(winObj));
expect(ajaxStub.firstCall.args[1]).to.equal(JSON.stringify(winObj));
});
});

Expand Down

0 comments on commit cadee22

Please sign in to comment.