Skip to content

Commit

Permalink
Removed redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
Fennne committed Dec 9, 2024
1 parent 2c1fbd3 commit ef3f404
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions test/public/runs/detail.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,45 +541,50 @@ module.exports = () => {
const tagsBadgeClassesSelector = '#Run-tags .badge';
// Wait for badge elements to appear
await page.waitForSelector(tagsBadgeClassesSelector);

// Evaluate and check for inline background color
const badgesWithStyles = await page.$$eval(
return await page.$$eval(
tagsBadgeClassesSelector,
(badges) => badges.map((badge) => ({
className: badge.className,
backgroundColor: badge.style.backgroundColor,
})),
);

return badgesWithStyles;
};

let badges;
let updateTagDto = {};
const expectedBgColorBefore = ['bg-gray-light', 'b-gray-light'];
const expectedBgColorBefore = 'badge b1 b-gray-light bg-gray-light';
const expectedBgColorAfter = 'rgb(255, 0, 0)'; //Red

// Fetch the run data before update of tag
await goToRunDetails(page, 106);

badges = await getRunTagsBadges();

expect(badges[0].className).to.contain.oneOf(expectedBgColorBefore);
expect(badges[0].className).to.eql(expectedBgColorBefore);

updateTagDto = await UpdateTagDto.validateAsync({
updateTagDto = {
body: {
color: '#FF0000', //Red
},
params: {
tagId: 1,
},
});
updateTagDto.session = {
personid: 1,
id: 1,
name: 'John Doe',
session: {
personid: 1,
id: 1,
name: 'John Doe',
},
};

/*
* UpdateTagDto.session = {
* personid: 1,
* id: 1,
* name: 'John Doe',
* };
*/

await new UpdateTagUseCase()
.execute(updateTagDto);

Expand Down

0 comments on commit ef3f404

Please sign in to comment.