Skip to content

Commit 14ef08a

Browse files
committed
test(frontend): fix missing microtask ticks for openFanOutModal tests
fetchOverridesForAccounts adds one extra async boundary vs the old inline Promise.all; DOM-querying tests in #111 (issue j) and #132 (mixed-SP, umbrella-SP) need 4 Promise.resolve() ticks, not 3.
1 parent dfb1381 commit 14ef08a

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

‎frontend/src/__tests__/recommendations.test.ts‎

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3437,7 +3437,10 @@ describe('Issue #111: per-bucket Payment seed from per-account service override'
34373437

34383438
await loadRecommendations();
34393439
(document.getElementById('bulk-purchase-btn') as HTMLButtonElement).click();
3440-
await Promise.resolve(); await Promise.resolve(); await Promise.resolve();
3440+
// fetchOverridesForAccounts is a separate async function (one extra
3441+
// microtask boundary vs the previous inline Promise.all); four ticks
3442+
// are needed for openFanOutModal to finish populating the DOM.
3443+
await Promise.resolve(); await Promise.resolve(); await Promise.resolve(); await Promise.resolve();
34413444

34423445
// Change the multi-account 1yr bucket's bucket-level Payment dropdown.
34433446
const bucketSelects = Array.from(
@@ -3719,8 +3722,10 @@ describe('Issue #132: bulk-buy collapses SP plan types into one bucket', () => {
37193722

37203723
await loadRecommendations();
37213724
(document.getElementById('bulk-purchase-btn') as HTMLButtonElement).click();
3722-
// openFanOutModal is async (issue #111 prefetch); wait a tick.
3723-
await Promise.resolve(); await Promise.resolve(); await Promise.resolve();
3725+
// fetchOverridesForAccounts is a separate async function (one extra
3726+
// microtask boundary vs the previous inline Promise.all); four ticks
3727+
// are needed for openFanOutModal to finish populating the DOM.
3728+
await Promise.resolve(); await Promise.resolve(); await Promise.resolve(); await Promise.resolve();
37243729

37253730
const { getFanOutBuckets } = await import('../recommendations');
37263731
const buckets = getFanOutBuckets();
@@ -3815,7 +3820,10 @@ describe('Issue #132: bulk-buy collapses SP plan types into one bucket', () => {
38153820

38163821
await loadRecommendations();
38173822
(document.getElementById('bulk-purchase-btn') as HTMLButtonElement).click();
3818-
await Promise.resolve(); await Promise.resolve(); await Promise.resolve();
3823+
// fetchOverridesForAccounts is a separate async function (one extra
3824+
// microtask boundary vs the previous inline Promise.all); four ticks
3825+
// are needed for openFanOutModal to finish populating the DOM.
3826+
await Promise.resolve(); await Promise.resolve(); await Promise.resolve(); await Promise.resolve();
38193827

38203828
// The SP bucket section must contain a <details> element with the
38213829
// plan-type breakdown (issue #249).
@@ -3862,7 +3870,10 @@ describe('Issue #132: bulk-buy collapses SP plan types into one bucket', () => {
38623870

38633871
await loadRecommendations();
38643872
(document.getElementById('bulk-purchase-btn') as HTMLButtonElement).click();
3865-
await Promise.resolve(); await Promise.resolve(); await Promise.resolve();
3873+
// fetchOverridesForAccounts is a separate async function (one extra
3874+
// microtask boundary vs the previous inline Promise.all); four ticks
3875+
// are needed for openFanOutModal to finish populating the DOM.
3876+
await Promise.resolve(); await Promise.resolve(); await Promise.resolve(); await Promise.resolve();
38663877

38673878
const spSections = Array.from(document.querySelectorAll('.fanout-bucket')).filter(
38683879
(s) => s.querySelector('h4')?.textContent?.includes('Savings Plans'),

0 commit comments

Comments
 (0)