-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Aliasbidder fix #1652
Aliasbidder fix #1652
Changes from 6 commits
b7ab1c1
57c6167
3d9d2dc
9352eb7
df9a5c0
e9acb26
049a8a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,9 @@ import AdapterManager from 'src/adaptermanager'; | |
import { getAdUnits } from 'test/fixtures/fixtures'; | ||
import CONSTANTS from 'src/constants.json'; | ||
import * as utils from 'src/utils'; | ||
import { registerBidder } from 'src/adapters/bidderFactory'; | ||
|
||
require('modules/appnexusAstBidAdapter'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Accidental import? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not accidental, i took a shortcut to test old way of aliasing adapter. Since we will be only keeping this code for a short time. But anyway, updated test case to make it as it should be. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah ok... no worries either way. |
||
|
||
const CONFIG = { | ||
enabled: true, | ||
|
@@ -81,4 +84,35 @@ describe('adapterManager tests', () => { | |
expect(spy.called).to.equal(false); | ||
}); | ||
}) | ||
|
||
describe('aliasBidderAdaptor', function() { | ||
let spec; | ||
const CODE = 'sampleBidder'; | ||
beforeEach(() => { | ||
spec = { | ||
code: CODE, | ||
isBidRequestValid: () => {}, | ||
buildRequests: () => {}, | ||
interpretResponse: () => {}, | ||
getUserSyncs: () => {} | ||
}; | ||
}); | ||
|
||
// Note remove this test case once Prebid is 1.0 | ||
it('should add alias to registry', () => { | ||
const bidderCode = 'appnexusAst'; | ||
const alias = 'testalias'; | ||
AdapterManager.aliasBidAdapter(bidderCode, alias); | ||
expect(AdapterManager.bidderRegistry).to.have.property(alias); | ||
}); | ||
|
||
it('should add alias to registry when original adapter is using bidderFactory', function() { | ||
let thisSpec = Object.assign(spec, { supportedMediaTypes: ['video'] }); | ||
registerBidder(thisSpec); | ||
const alias = 'aliasBidder'; | ||
AdapterManager.aliasBidAdapter(CODE, alias); | ||
expect(AdapterManager.bidderRegistry).to.have.property(alias); | ||
expect(AdapterManager.videoAdapters).to.include(alias); | ||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth doing an Object.freeze on the
spec
here.Otherwise someone could call
getSpec()
and then mutate that object, producing some absolutely horrible bugs. IMO, the burden lies on the file implementer to make sure there's no way to "misuse" the functions they make public.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.