From 9f364228992b5559e3b81736d5d0ee513bc226a1 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Fri, 19 Sep 2025 22:58:53 +0700 Subject: [PATCH 1/3] fix PolicyTagTest flaky --- tests/utils/collections/policyTags.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/utils/collections/policyTags.ts b/tests/utils/collections/policyTags.ts index 6854c669a5b5..334c0cdc2afa 100644 --- a/tests/utils/collections/policyTags.ts +++ b/tests/utils/collections/policyTags.ts @@ -4,7 +4,8 @@ import type {PolicyTagLists, PolicyTags} from '@src/types/onyx'; export default function createRandomPolicyTags(tagListName: string, numberOfTags = 0): PolicyTagLists { const tags: PolicyTags = {}; for (let i = 0; i < numberOfTags; i++) { - const tagName = randWord(); + // prevent the tagName can be duplicated + const tagName = `${randWord()}${i}`; tags[tagName] = { name: tagName, enabled: true, From 39f2d3d689d7dc21ca35df649b0e35b193895fd5 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Fri, 19 Sep 2025 23:38:26 +0700 Subject: [PATCH 2/3] update comment --- tests/utils/collections/policyTags.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/utils/collections/policyTags.ts b/tests/utils/collections/policyTags.ts index 334c0cdc2afa..9931bafc4a58 100644 --- a/tests/utils/collections/policyTags.ts +++ b/tests/utils/collections/policyTags.ts @@ -4,7 +4,8 @@ import type {PolicyTagLists, PolicyTags} from '@src/types/onyx'; export default function createRandomPolicyTags(tagListName: string, numberOfTags = 0): PolicyTagLists { const tags: PolicyTags = {}; for (let i = 0; i < numberOfTags; i++) { - // prevent the tagName can be duplicated + // Prevent the tag name from being duplicated, which can happen when a lot of tests are being ran + // and can cause tests to fail because tag lists must always contain a unique set of tags const tagName = `${randWord()}${i}`; tags[tagName] = { name: tagName, From e6d8049501d8915bd703c49667bfd7ef48b3c3ef Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Fri, 19 Sep 2025 23:42:59 +0700 Subject: [PATCH 3/3] run prettier --- tests/utils/collections/policyTags.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/utils/collections/policyTags.ts b/tests/utils/collections/policyTags.ts index 9931bafc4a58..e76ba1eabf4d 100644 --- a/tests/utils/collections/policyTags.ts +++ b/tests/utils/collections/policyTags.ts @@ -4,7 +4,7 @@ import type {PolicyTagLists, PolicyTags} from '@src/types/onyx'; export default function createRandomPolicyTags(tagListName: string, numberOfTags = 0): PolicyTagLists { const tags: PolicyTags = {}; for (let i = 0; i < numberOfTags; i++) { - // Prevent the tag name from being duplicated, which can happen when a lot of tests are being ran + // Prevent the tag name from being duplicated, which can happen when a lot of tests are being ran // and can cause tests to fail because tag lists must always contain a unique set of tags const tagName = `${randWord()}${i}`; tags[tagName] = {