@stigmer/react 3.5.2 → 3.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stigmer/react",
3
- "version": "3.5.2",
3
+ "version": "3.5.3",
4
4
  "description": "React provider and client hook for the Stigmer platform SDK",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -37,7 +37,7 @@
37
37
  "dependencies": {
38
38
  "@bufbuild/protovalidate": "^1.1.1",
39
39
  "@dagrejs/dagre": "^1.1.4",
40
- "@stigmer/theme": "3.5.2",
40
+ "@stigmer/theme": "3.5.3",
41
41
  "diff": "^8.0.3",
42
42
  "fflate": "^0.8.2",
43
43
  "hast-util-to-jsx-runtime": "^2.3.6",
@@ -60,8 +60,8 @@
60
60
  "@codemirror/state": "^6.0.0",
61
61
  "@codemirror/view": "^6.0.0",
62
62
  "@lezer/highlight": "^1.0.0",
63
- "@stigmer/protos": "3.5.2",
64
- "@stigmer/sdk": "3.5.2",
63
+ "@stigmer/protos": "3.5.3",
64
+ "@stigmer/sdk": "3.5.3",
65
65
  "@tanstack/react-table": "^8.20.0",
66
66
  "@xyflow/react": "^12.0.0",
67
67
  "elkjs": "^0.9.0",
@@ -1,5 +1,11 @@
1
- import { describe, it, expect, vi, afterEach } from "vitest";
2
- import { render, screen, fireEvent, cleanup } from "@testing-library/react";
1
+ import { describe, it, expect, vi, afterEach, beforeEach } from "vitest";
2
+ import {
3
+ render,
4
+ screen,
5
+ fireEvent,
6
+ cleanup,
7
+ waitFor,
8
+ } from "@testing-library/react";
3
9
  import type { ReactNode } from "react";
4
10
  import { create } from "@bufbuild/protobuf";
5
11
  import type { Stigmer } from "@stigmer/sdk";
@@ -47,6 +53,17 @@ function renderCard(ui: ReactNode) {
47
53
 
48
54
  afterEach(cleanup);
49
55
 
56
+ // The download flow ends in a transient-anchor click with target="_blank".
57
+ // Left unstubbed, happy-dom treats that click as a real popup navigation and
58
+ // fetches the fixture URL over the actual network — after this test has
59
+ // already returned, so the DNS failure gets attributed to whichever test the
60
+ // worker is running by then (the flake in issue #334).
61
+ beforeEach(() => {
62
+ vi.spyOn(HTMLAnchorElement.prototype, "click")
63
+ .mockImplementation(() => {})
64
+ .mockClear();
65
+ });
66
+
50
67
  describe("PlanArtifactCard — compact document card", () => {
51
68
  it("is an accessible region with the plan's title, filename, and size", () => {
52
69
  renderCard(
@@ -178,6 +195,7 @@ describe("PlanArtifactCard — compact document card", () => {
178
195
 
179
196
  it("downloads the artifact on demand via a freshly minted URL", async () => {
180
197
  const { stigmer, getArtifactDownloadUrl } = createStigmerMock();
198
+ const anchorClick = vi.spyOn(HTMLAnchorElement.prototype, "click");
181
199
  render(
182
200
  withStigmer(
183
201
  <PlanArtifactCard executionId="aex_1" artifact={planArtifact} org="acme" />,
@@ -191,6 +209,9 @@ describe("PlanArtifactCard — compact document card", () => {
191
209
  const req = getArtifactDownloadUrl.mock.calls[0][0];
192
210
  expect(req.executionId).toBe("aex_1");
193
211
  expect(req.storageKey).toBe("artifacts/aex_1/plan.md");
212
+ // Wait for the mint-URL → anchor-click continuation INSIDE the test body;
213
+ // returning while it is still in flight is what let it escape.
214
+ await waitFor(() => expect(anchorClick).toHaveBeenCalledTimes(1));
194
215
  });
195
216
  });
196
217