From 757d19c2f756820628d6683c31f70cd9a26d2285 Mon Sep 17 00:00:00 2001
From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Date: Sun, 20 Nov 2022 07:12:01 -0800
Subject: Assert count

---
 test/bun.js/react-dom.test.tsx | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

(limited to 'test/bun.js/react-dom.test.tsx')

diff --git a/test/bun.js/react-dom.test.tsx b/test/bun.js/react-dom.test.tsx
index ae37fb494..04074acb8 100644
--- a/test/bun.js/react-dom.test.tsx
+++ b/test/bun.js/react-dom.test.tsx
@@ -258,6 +258,7 @@ describe("ReactDOM", () => {
         });
         const count = 4;
         it(`http server, ${count} requests`, async () => {
+          var remain = count;
           await (async function () {
             var server;
             try {
@@ -269,10 +270,9 @@ describe("ReactDOM", () => {
                   );
                 },
               });
-              var total = 0;
               gc();
-              while (total++ < count) {
-                var attempt = total;
+              while (remain--) {
+                var attempt = remain + 1;
                 const response = await fetch(
                   "http://localhost:" + server.port + "/",
                 );
@@ -293,10 +293,11 @@ describe("ReactDOM", () => {
               server.stop();
             }
           })();
-          expect(
-            heapStats().objectTypeCounts.ReadableHTTPResponseSinkController ??
-              0,
-          ).toBe(1);
+
+          const { ReadableHTTPResponseSinkController = 0 } =
+            heapStats().objectTypeCounts;
+          expect(ReadableHTTPResponseSinkController).toBe(1);
+          expect(remain + 1).toBe(0);
         });
       });
     }
-- 
cgit v1.2.3

