mengw15 commented on code in PR #6542:
URL: https://github.com/apache/texera/pull/6542#discussion_r3609619216


##########
frontend/src/app/dashboard/component/user/user-quota/user-quota.component.spec.ts:
##########
@@ -24,12 +24,18 @@ import { HttpClientTestingModule } from 
"@angular/common/http/testing";
 import { commonTestProviders } from "../../../../common/testing/test-utils";
 import { of } from "rxjs";
 import type { Mocked } from "vitest";
-import * as Plotly from "plotly.js-basic-dist-min";
 import { ExecutionQuota } from "../../../../common/type/user";
 import { DatasetQuota } from "../../../type/quota-statistic.interface";
 
-// Plotly is a read-only ESM namespace (can't be spied on), so mock the whole 
module.
-vi.mock("plotly.js-basic-dist-min", () => ({ newPlot: vi.fn() }));
+// Real Plotly renders into a DOM element by id; create one and assert on the
+// `data`/`layout` Plotly attaches to that graph div. (Module-level mocking of
+// plotly.js-basic-dist-min was flaky across the CI matrix — the mock did not
+// always intercept, letting the real newPlot throw "No DOM element with id".)
+function chartDiv(id: string): void {
+  const div = document.createElement("div");
+  div.id = id;
+  document.body.appendChild(div);
+}

Review Comment:
   Addressed — `chartDiv` now removes any pre-existing element with the same id 
before appending, so reruns/retries can't accumulate duplicate ids.



-- 
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