diff --git a/app/src/components/Actions/Actions.test.tsx b/app/src/components/Actions/Actions.test.tsx
index 28b4042..c4f166f 100644
--- a/app/src/components/Actions/Actions.test.tsx
+++ b/app/src/components/Actions/Actions.test.tsx
@@ -4,7 +4,7 @@ import { render, screen, act, fireEvent } from "@testing-library/react";
import { create } from "@bufbuild/protobuf";
import React from "react";
-import { parser_pb } from "../../runme/client";
+import { parser_pb, RunmeMetadataKey } from "../../runme/client";
import type { CellData } from "../../lib/notebookData";
import { Action } from "./Actions";
@@ -60,6 +60,47 @@ vi.mock("@runmedev/renderers", () => ({
vi.mock("../../contexts/CellContext", () => ({}));
+// Fake streams for testing PID/exitCode callbacks through CellConsole subscriptions.
+class FakeStreams {
+ private pidCbs = new Set<(pid: number) => void>();
+ private exitCbs = new Set<(code: number) => void>();
+ private stdoutCbs = new Set<(data: Uint8Array) => void>();
+ private stderrCbs = new Set<(data: Uint8Array) => void>();
+
+ stdout = {
+ subscribe: (cb: (data: Uint8Array) => void) => {
+ this.stdoutCbs.add(cb);
+ return { unsubscribe: () => this.stdoutCbs.delete(cb) };
+ },
+ };
+ stderr = {
+ subscribe: (cb: (data: Uint8Array) => void) => {
+ this.stderrCbs.add(cb);
+ return { unsubscribe: () => this.stderrCbs.delete(cb) };
+ },
+ };
+ pid = {
+ subscribe: (cb: (pid: number) => void) => {
+ this.pidCbs.add(cb);
+ return { unsubscribe: () => this.pidCbs.delete(cb) };
+ },
+ };
+ exitCode = {
+ subscribe: (cb: (code: number) => void) => {
+ this.exitCbs.add(cb);
+ return { unsubscribe: () => this.exitCbs.delete(cb) };
+ },
+ };
+
+ emitPid(pid: number) { this.pidCbs.forEach((cb) => cb(pid)); }
+ emitExitCode(code: number) { this.exitCbs.forEach((cb) => cb(code)); }
+ emitStdout(data: Uint8Array) { this.stdoutCbs.forEach((cb) => cb(data)); }
+
+ setCallback() {}
+ sendExecuteRequest() {}
+ close() {}
+}
+
// Minimal stub CellData to drive runID changes.
class StubCellData {
snapshot: parser_pb.Cell;
@@ -103,13 +144,16 @@ class StubCellData {
this.runListeners.forEach((l) => l(id));
}
+ fakeStreams: FakeStreams | null = null;
+
getStreams() {
- return null;
+ return this.fakeStreams;
}
addBefore() {}
addAfter() {}
remove() {}
run() {}
+ setRunner() {}
}
describe("Action component", () => {
@@ -189,4 +233,166 @@ describe("Action component", () => {
expect(updatedCell.kind).toBe(parser_pb.CellKind.MARKUP);
expect(updatedCell.languageId).toBe("markdown");
});
+
+ it("shows idle bracket [ ] before first run", () => {
+ const cell = create(parser_pb.CellSchema, {
+ refId: "cell-idle",
+ kind: parser_pb.CellKind.CODE,
+ languageId: "bash",
+ outputs: [],
+ metadata: {},
+ value: "echo hello",
+ });
+ const stub = new StubCellData(cell);
+
+ render(