-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
22e2234
commit 111d829
Showing
5 changed files
with
85 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { isValidVideoBid } from 'src/video'; | ||
const utils = require('src/utils'); | ||
|
||
describe('video.js', () => { | ||
it('validates valid instream bids', () => { | ||
sinon.stub(utils, 'getBidRequest', () => ({ | ||
bidder: 'appnexusAst', | ||
mediaTypes: { | ||
video: { context: 'instream' }, | ||
}, | ||
})); | ||
|
||
const valid = isValidVideoBid({ | ||
vastUrl: 'http://www.example.com/vastUrl' | ||
}); | ||
|
||
expect(valid).to.be(true); | ||
|
||
utils.getBidRequest.restore(); | ||
}); | ||
|
||
it('catches invalid instream bids', () => { | ||
sinon.stub(utils, 'getBidRequest', () => ({ | ||
bidder: 'appnexusAst', | ||
mediaTypes: { | ||
video: { context: 'instream' }, | ||
}, | ||
})); | ||
|
||
const valid = isValidVideoBid({}); | ||
|
||
expect(valid).to.be(false); | ||
|
||
utils.getBidRequest.restore(); | ||
}); | ||
|
||
it('validates valid outstream bids', () => { | ||
sinon.stub(utils, 'getBidRequest', () => ({ | ||
bidder: 'appnexusAst', | ||
mediaTypes: { | ||
video: { context: 'outstream' }, | ||
}, | ||
renderer: { | ||
url: 'render.url', | ||
render: () => true, | ||
} | ||
})); | ||
|
||
const valid = isValidVideoBid({}); | ||
|
||
expect(valid).to.be(true); | ||
|
||
utils.getBidRequest.restore(); | ||
}); | ||
|
||
it('catches invalid outstream bids', () => { | ||
sinon.stub(utils, 'getBidRequest', () => ({ | ||
bidder: 'appnexusAst', | ||
mediaTypes: { | ||
video: { context: 'outstream' }, | ||
}, | ||
})); | ||
|
||
const valid = isValidVideoBid({}); | ||
|
||
expect(valid).to.be(false); | ||
|
||
utils.getBidRequest.restore(); | ||
}); | ||
}); |