一键导入
testing
Go table-driven tests, Python pytest patterns, React Testing Library, property-based testing, and integration test conventions for Omega
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Go table-driven tests, Python pytest patterns, React Testing Library, property-based testing, and integration test conventions for Omega
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use whenever the user wants to run, plan, kick off, iterate on, or close out a Victoria training version (e.g. "let's start V200", "next training run", "kick off the next iteration", "what should we try next for Victoria", "ship V###", "log this training run"). Codifies the continual-improvement loop — read the latest entry in omega/nodes/victoria/training_log/, propose the next version's hypothesis, run the gates, write the new V###.md entry, update the high-water table, commit, and push.
Structured research pipeline for Omega — takes an idea or hypothesis, searches for evidence, compares to existing Omega capabilities, and delivers a verdict with implementation recommendations. Use when asked to /research a topic, evaluate a new signal source, assess an external tool/library, or investigate trading strategies.
IterDRAG iterative retrieval-augmented generation pattern — search, summarize, reflect loop for deep research tasks
Go coding standards, error handling, concurrency, and Connect-RPC conventions for the Omega project
Buf conventions, proto3 best practices, schema evolution rules, and Connect-ES v2 frontend patterns for Omega
| name | testing |
| description | Go table-driven tests, Python pytest patterns, React Testing Library, property-based testing, and integration test conventions for Omega |
| tags | ["testing","go","pytest","python","react","integration-testing","property-testing"] |
func TestAdd(t *testing.T) {
tests := []struct {
name string
a, b float64
want float64
wantErr bool
}{
{"positive", 3, 4, 7, false},
{"negative", -1, -1, -2, false},
{"float", 1.5, 2.5, 4.0, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := Add(tt.a, tt.b)
if (err != nil) != tt.wantErr {
t.Fatalf("error = %v, wantErr %v", err, tt.wantErr)
}
if got != tt.want {
t.Errorf("got %v, want %v", got, tt.want)
}
})
}
}
func assertNoError(t *testing.T, err error) {
t.Helper() // failure line points to the caller, not here
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
}
func TestOmegaAPIIntegration(t *testing.T) {
addr := os.Getenv("OMEGA_API_ADDR")
if addr == "" {
t.Skip("OMEGA_API_ADDR not set — skipping integration test")
}
// ... test against real server
}
func FuzzParseNodeID(f *testing.F) {
f.Add("node-123")
f.Add("")
f.Fuzz(func(t *testing.T, id string) {
result := ParseNodeID(id) // must never panic
_ = result
})
}
Run: go test -fuzz FuzzParseNodeID -fuzztime 30s
class TestCalculatorNode:
def setup_method(self):
"""Fresh instance before each test."""
self.node = CalculatorNode()
def test_add_basic(self):
out = self.node.execute(NodeInput(action="add", parameters={"a": 3, "b": 4}))
assert out.success
assert out.result == 7.0
def test_request_id_propagated(self):
inp = NodeInput(action="add", parameters={"a": 1, "b": 1})
out = self.node.execute(inp)
assert out.request_id == inp.request_id
def test_divide_by_zero(self):
out = self.node.execute(NodeInput(action="divide", parameters={"a": 10, "b": 0}))
assert not out.success
assert any("zero" in e.lower() for e in out.errors)
def test_improvement_changes_version(self):
assert self.node.version == "1.0"
changed = self.node.improve({"improve_latency": True, "iteration": 0})
assert changed is True
assert self.node.version == "1.1"
import tempfile, os
def test_writes_file():
with tempfile.TemporaryDirectory() as tmpdir:
node = SkillCreatorNode(skills_root=tmpdir)
# ... test file creation in isolation
assert os.path.isfile(os.path.join(tmpdir, "my-skill", "SKILL.md"))
When testing nodes with brain integration, use the default NoBrain (no API calls, zero latency):
def test_consult_brain_with_no_brain(self):
node = MyNode() # default: NoBrain
response = node.consult_brain("improve")
assert response.action == "pass" # NoBrain always returns "pass"
import { render, screen } from "@testing-library/react";
import { NodeCard } from "./NodeCard";
test("shows node name and health", () => {
render(<NodeCard node={{ name: "CalculatorNode", health: 0.9 }} />);
expect(screen.getByText("CalculatorNode")).toBeInTheDocument();
expect(screen.getByRole("progressbar")).toHaveAttribute("aria-valuenow", "90");
});
import userEvent from "@testing-library/user-event";
test("submits brain config form", async () => {
const onSubmit = jest.fn();
render(<BrainConfigPanel onSubmit={onSubmit} />);
await userEvent.selectOptions(screen.getByLabelText("Provider"), "anthropic");
await userEvent.click(screen.getByRole("button", { name: /save/i }));
expect(onSubmit).toHaveBeenCalledWith(expect.objectContaining({ provider: "anthropic" }));
});
jest.mock("../lib/client", () => ({
client: {
getNode: jest.fn().mockResolvedValue({ node: { name: "Test", health: 1.0 } }),
},
}));
dry_run=True or mock adapters for anything touching network/disk.tempfile.TemporaryDirectory() — never pollute the real skills dir.NoBrain unless specifically testing LLM integration.t.Skip when env vars absent.# Python — all tests
pytest tests/ -v
# Python — specific file
pytest tests/test_skill_loader.py -v
# Python — with coverage
pytest tests/ --cov=omega --cov-report=term-missing
# Go — all
go test ./... -v
# Frontend
cd dashboard && npm test