Skip to content

fix: Address code coverage warnings from TiCS dashboard for publisher utils#5098

Merged
steverydz merged 1 commit intomainfrom
fix-tics-code-coverage-warnings-publisher-utils
Apr 15, 2025
Merged

fix: Address code coverage warnings from TiCS dashboard for publisher utils#5098
steverydz merged 1 commit intomainfrom
fix-tics-code-coverage-warnings-publisher-utils

Conversation

@steverydz
Copy link
Copy Markdown
Contributor

@steverydz steverydz commented Apr 14, 2025

Done

Adds tests for publisher utils

How to QA

All tests should pass (except the inclusive naming check)

Testing

  • This PR has tests
  • No testing required (explain why):

@webteam-app
Copy link
Copy Markdown

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

Inclusive naming check

[Inclusive naming check] reported by reviewdog 🐶
[warning] blacklist may be insensitive, use denylist, blocklist instead


[Inclusive naming check] reported by reviewdog 🐶
[warning] blacklist may be insensitive, use denylist, blocklist instead

expect(changes.blacklist_countries).toHaveLength(0);


[Inclusive naming check] reported by reviewdog 🐶
[warning] whitelist may be insensitive, use allowlist instead

expect(changes.whitelist_countries).toHaveLength(0);


[Inclusive naming check] reported by reviewdog 🐶
[warning] blacklist may be insensitive, use denylist, blocklist instead

test("handles setting custom blacklist countries", () => {


[Inclusive naming check] reported by reviewdog 🐶
[warning] blacklist may be insensitive, use denylist, blocklist instead


[Inclusive naming check] reported by reviewdog 🐶
[warning] blacklist may be insensitive, use denylist, blocklist instead


[Inclusive naming check] reported by reviewdog 🐶
[warning] blacklist may be insensitive, use denylist, blocklist instead

expect(changes.blacklist_countries).toEqual(["EN", "US", "FR"]);


[Inclusive naming check] reported by reviewdog 🐶
[warning] whitelist may be insensitive, use allowlist instead

expect(changes.whitelist_countries).toHaveLength(0);

if (dirtyFields?.whitelist_country_keys) {
if (!data?.whitelist_country_keys.length) {
if (
!data?.whitelist_country_keys ||
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Inclusive naming check] reported by reviewdog 🐶
[warning] whitelist may be insensitive, use allowlist instead

if (!data?.whitelist_country_keys.length) {
if (
!data?.whitelist_country_keys ||
!data?.whitelist_country_keys.length
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Inclusive naming check] reported by reviewdog 🐶
[warning] whitelist may be insensitive, use allowlist instead

if (dirtyFields?.blacklist_country_keys) {
if (!data?.blacklist_country_keys.length) {
if (
!data?.blacklist_country_keys ||
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Inclusive naming check] reported by reviewdog 🐶
[warning] blacklist may be insensitive, use denylist, blocklist instead

if (!data?.blacklist_country_keys.length) {
if (
!data?.blacklist_country_keys ||
!data?.blacklist_country_keys.length
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Inclusive naming check] reported by reviewdog 🐶
[warning] blacklist may be insensitive, use denylist, blocklist instead

import getSettingsData from "../getSettingsData";

const testSettingsData = {
whitelist_countries: [],
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Inclusive naming check] reported by reviewdog 🐶
[warning] whitelist may be insensitive, use allowlist instead


test("handles setting custom whitelist countries", () => {
const changes = getSettingsChanges(
{ whitelist_country_keys: true },
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Inclusive naming check] reported by reviewdog 🐶
[warning] whitelist may be insensitive, use allowlist instead

{ whitelist_country_keys: true },
{
territory_distribution_status: "custom",
whitelist_country_keys: "EN US FR",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Inclusive naming check] reported by reviewdog 🐶
[warning] whitelist may be insensitive, use allowlist instead

},
);

expect(changes.whitelist_countries).toEqual(["EN", "US", "FR"]);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Inclusive naming check] reported by reviewdog 🐶
[warning] whitelist may be insensitive, use allowlist instead

);

expect(changes.whitelist_countries).toEqual(["EN", "US", "FR"]);
expect(changes.blacklist_countries).toHaveLength(0);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Inclusive naming check] reported by reviewdog 🐶
[warning] blacklist may be insensitive, use denylist, blocklist instead

expect(changes.blacklist_countries).toHaveLength(0);
});

test("handles removing custom blacklist countries", () => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Inclusive naming check] reported by reviewdog 🐶
[warning] blacklist may be insensitive, use denylist, blocklist instead

@steverydz steverydz changed the title fix: Address code coverage warnings from TiCS dashboard for publisher… fix: Address code coverage warnings from TiCS dashboard for publisher utils Apr 14, 2025
@steverydz steverydz merged commit 45835bf into main Apr 15, 2025
10 of 11 checks passed
@steverydz steverydz deleted the fix-tics-code-coverage-warnings-publisher-utils branch April 15, 2025 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants