-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for legacyNativeRender to accept only one argument
- Loading branch information
Michele Nasti
committed
Sep 22, 2022
1 parent
1b06763
commit f1e96b0
Showing
3 changed files
with
45 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import '../../src/legacyNativeRender'; | ||
|
||
describe('legacyNativeRender', () => { | ||
|
||
after(() => { | ||
delete window.pbNativeTag; | ||
}) | ||
it('should accept only one argument', () => { | ||
expect(window.pbNativeTag.renderNativeAd).to.exist; | ||
//expect exactly one argument by this function | ||
expect(window.pbNativeTag.renderNativeAd.length).to.equal(1); | ||
|
||
// try to call this function with two arguments and see it throw | ||
const renderNativeAdWithTwoArguments = window.pbNativeTag.renderNativeAd.bind(this, document, { | ||
pubUrl: 'http://prebidjs.com', | ||
adId: 'abc123' | ||
}) | ||
expect(renderNativeAdWithTwoArguments).to.throw(); | ||
|
||
}) | ||
}) |
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,23 @@ | ||
import '../../src/nativeRender'; | ||
|
||
describe('nativeRender', () => { | ||
|
||
after(() => { | ||
delete window.ucTag; | ||
}) | ||
|
||
it('should accept 2 arguments', () => { | ||
expect(window.ucTag.renderAd).to.exist; | ||
//expect exactly two arguments by this function | ||
expect(window.ucTag.renderAd.length).to.equal(2); | ||
|
||
// this function with two arguments and see it NOT throwing | ||
const renderAd = window.ucTag.renderAd.bind(this, document, { | ||
pubUrl: 'http://prebidjs.com', | ||
adId: 'abc123', | ||
replaceAllAssets: true | ||
}) | ||
expect(renderAd).to.not.throw(); | ||
|
||
}) | ||
}) |