Skip to content

Commit

Permalink
silence typescript eslint warnings by forcing types instead of disabl…
Browse files Browse the repository at this point in the history
…ing eslint
  • Loading branch information
cemms1 committed Feb 4, 2025
1 parent e6517ee commit 44edaea
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions playwright/tests/targeting.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,23 @@ test.describe('GAM targeting', () => {
});
});

type CriteoRequestPostBody = {
imp: Array<{
id: string;
}>;
};
test.describe('Prebid targeting', () => {
test.beforeEach(async ({ page }) => {
return page.route(`${bidderURLs.criteo}**`, (route) => {
const url = route.request().url();
if (url.includes(bidderURLs.criteo)) {
// The mock bid reponse impid must match that sent in the request
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- see above
const impId =
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- we need the id from the request object
JSON.parse(String(route.request().postData())).imp[0].id;
const postData = route.request().postData();
const json = JSON.parse(
postData?.toString() ?? '',
) as CriteoRequestPostBody;
const impId = json.imp[0]?.id as string;

void route.fulfill({
body: JSON.stringify(criteoMockBidResponse(impId)),
});
Expand Down

0 comments on commit 44edaea

Please sign in to comment.