Skip to content

Commit

Permalink
improve currency u.t.
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztofequativ committed Oct 21, 2024
1 parent 9f9c133 commit 08e3c52
Showing 1 changed file with 26 additions and 22 deletions.
48 changes: 26 additions & 22 deletions test/spec/modules/smartadserverBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1428,49 +1428,53 @@ describe('Smart bid adapter tests', function () {
}
},
getFloor: (data) => {
if (data.mediaType === BANNER) {
if (data.size[0] === 300 && data.size[1] === 250) {
return { floor: 1.2 };
} else if (data.size[0] === 300 && data.size[1] === 600) {
return { floor: 1.4 };
} else if (data.size[0] === 30 && data.size[1] === 60) {
return 'string';
if (data.currency === 'USD') {
if (data.mediaType === BANNER) {
if (data.size[0] === 300 && data.size[1] === 250) {
return { floor: 1.2 };
} else if (data.size[0] === 300 && data.size[1] === 600) {
return { floor: 1.4 };
} else if (data.size[0] === 30 && data.size[1] === 60) {
return 'string';
} else {
return { floor: 1.0 };
}
} else if (data.mediaType === VIDEO) {
if (data.size[0] === 640 && data.size[1] === 480) {
return { floor: 2.3 };
} else {
return { floor: 2.1 };
}
} else {
return { floor: 1.0 };
}
} else if (data.mediaType === VIDEO) {
if (data.size[0] === 640 && data.size[1] === 480) {
return { floor: 2.3 };
} else {
return { floor: 2.1 };
return {};
}
} else {
return {};
return undefined;
}
}
};
});

it('should return lowest floor from specified ones', () => {
expect(spec.getBidFloor(bid, 'DKK', BANNER)).to.deep.eq(1.2);
expect(spec.getBidFloor(bid, 'USD', BANNER)).to.deep.eq(1.2);
});

it('should return default floor for media type whatever size', () => {
bid.mediaTypes.banner.sizes.push([300, 400]);
expect(spec.getBidFloor(bid, 'DKK', BANNER)).to.deep.eq(1.0);
expect(spec.getBidFloor(bid, 'USD', BANNER)).to.deep.eq(1.0);
});

it('should return default floor', () => {
expect(spec.getBidFloor(bid, 'DKK', VIDEO)).to.deep.eq(0);
expect(spec.getBidFloor(bid, 'USD', VIDEO)).to.deep.eq(0);
});

it('should return default floor when currency not passed', () => {
it('should return floor when currency not passed', () => {
expect(spec.getBidFloor(bid, undefined, BANNER)).to.deep.eq(1.2);
});

it('should return DEFAULT_FLOOR in case of not a number value from floor module', () => {
bid.mediaTypes.banner.sizes.push([30, 60]);
expect(spec.getBidFloor(bid, 'DKK', BANNER)).to.deep.eq(0);
expect(spec.getBidFloor(bid, 'USD', BANNER)).to.deep.eq(0);
});

it('should return proper video floor', () => {
Expand All @@ -1481,7 +1485,7 @@ describe('Smart bid adapter tests', function () {
]
}
};
expect(spec.getBidFloor(bid, 'DKK', VIDEO)).to.deep.eq(2.3);
expect(spec.getBidFloor(bid, 'USD', VIDEO)).to.deep.eq(2.3);
});

it('should return default video floor', () => {
Expand All @@ -1492,7 +1496,7 @@ describe('Smart bid adapter tests', function () {
]
}
};
expect(spec.getBidFloor(bid, 'DKK', VIDEO)).to.deep.eq(2.1);
expect(spec.getBidFloor(bid, 'USD', VIDEO)).to.deep.eq(2.1);
});

it('should return DEFAULT_FLOOR for not supported media type', () => {
Expand Down

0 comments on commit 08e3c52

Please sign in to comment.