Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mailonline/video-ad-sdk

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mailonline/video-ad-sdk - npm Package Compare versions

Comparing version 1.3.3 to 1.3.4

2

package.json
{
"name": "@mailonline/video-ad-sdk",
"version": "1.3.3",
"version": "1.3.4",
"description": "Video ad SDK to load and play video ads",

@@ -5,0 +5,0 @@ "keywords": [

@@ -21,2 +21,10 @@ import {

import startVideoAd from '../startVideoAd';
import {
start,
closeLinear
} from '../../../tracker/linearEvents';
import {
adStopped,
adUserClose
} from '../../../adUnit/helpers/vpaid/api';

@@ -174,3 +182,28 @@ jest.mock('../../../adUnit/createVideoAdUnit');

test('must cancel the ad unit if there is an error starting the VPAID ad unit', async () => {
[
adUserClose,
adStopped,
closeLinear
].forEach((event) => {
test(`must cancel the ad unit start on '${event}' event`, async () => {
expect.assertions(1);
const adUnit = createAdUnitMock(vastAdChain, videoAdContainer, options);
createVideoAdUnit.mockImplementation(() => {
adUnit.start = () => {
adUnit.emit(event);
};
return adUnit;
});
try {
await startVideoAd(vpaidAdChain, videoAdContainer, options);
} catch (error) {
expect(error.message).toBe(`Ad unit start rejected due to event '${event}'`);
}
});
});
test('must onAdReady event if the ad unit gets canceled', async () => {
expect.assertions(5);

@@ -182,3 +215,2 @@ canPlay.mockReturnValue(false);

createVideoAdUnit.mockImplementation(() => {
// eslint-disable-next-line promise/always-return, promise/always-return, promise/catch-or-return, promise/prefer-await-to-then
adUnit.start = () => {

@@ -212,3 +244,3 @@ adUnit.__simulateError(adUnitError);

adUnit.start = () => {
adUnit.emit('start');
adUnit.emit(start);
};

@@ -263,3 +295,3 @@

adUnit.start = () => {
adUnit.emit('start');
adUnit.emit(start);
};

@@ -266,0 +298,0 @@

@@ -5,2 +5,10 @@ import createVideoAdUnit from '../../adUnit/createVideoAdUnit';

import canPlay from '../../adUnit/helpers/media/canPlay';
import {
start,
closeLinear
} from '../../tracker/linearEvents';
import {
adStopped,
adUserClose
} from '../../adUnit/helpers/vpaid/api';

@@ -30,4 +38,10 @@ const validate = (vastChain, videoAdContainer) => {

const startAdUnit = (adUnit, {onAdReady}) => new Promise((resolve, reject) => {
const createRejectHandler = (event) => () =>
reject(new Error(`Ad unit start rejected due to event '${event}'`));
adUnit.onError(reject);
adUnit.on('start', () => resolve(adUnit));
adUnit.on(start, () => resolve(adUnit));
adUnit.on(adUserClose, createRejectHandler(adUserClose));
adUnit.on(closeLinear, createRejectHandler(closeLinear));
adUnit.on(adStopped, createRejectHandler(adStopped));

@@ -34,0 +48,0 @@ onAdReady(adUnit);

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc