Copilot commented on code in PR #7843:
URL: https://github.com/apache/texera/pull/7843#discussion_r3836082407


##########
frontend/src/app/workspace/component/code-editor-dialog/code-editor.component.spec.ts:
##########
@@ -951,4 +969,488 @@ describe("CodeEditorComponent", () => {
       expect(container.style.width).toBe("790px");
     });
   });
+
+  // The editor really does come up under jsdom: `ensureVscodeApiStarted()`
+  // resolves, `EditorApp.start()` mounts a live monaco editor over a real text
+  // model, and the component's subscribe callback then binds that model to the
+  // yjs text. Nothing here is mocked out — the bring-up is asynchronous, so 
the
+  // tests wait on the observable effect instead of on a fixed number of ticks.
+  const settle = () => new Promise(resolve => setTimeout(resolve, 0));
+
+  async function waitFor(condition: () => boolean, what: string): 
Promise<void> {
+    for (let attempt = 0; attempt < 400; attempt++) {
+      if (condition()) return;
+      await new Promise(resolve => setTimeout(resolve, 10));
+    }
+    throw new Error(`timed out waiting for ${what}`);
+  }

Review Comment:
   waitFor() hard-codes its polling interval and attempt count (400 × 10ms). 
Since these values define the test timeout behavior and are now part of the 
spec’s contract, it would be clearer/safer to express them as named constants 
(e.g., maxWaitMs + intervalMs) or derive them from a single max timeout so 
future edits don’t accidentally change the effective wait window.
   
   This issue also appears on line 1264 of the same file.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to