This repository has been archived on 2026-11-17. You can view files and clone it, but cannot push or open issues or pull requests.
gitgram-ai/aitimemachine/beads/cmd/bd/create_notes_test.go
caelum0x 49b183818c Unify gitgram + aitimemachine into the monorepo (de-submodule) and merge vendored engines
Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as
opaque submodule gitlinks on GitHub) into fully-tracked first-party content.

AITM now merges its 7 vendored repos as first-party engines:
- memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts
- git: vendored C git (bundled binary) + gitnexus (in-process code intelligence)
- agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess)

Includes the full session's product build: Gitgram web/mobile/backend features,
AITM website/CLI/MCP, the unified memory layer, engine build tooling
(scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md),
and extensive test suites.

Build artifacts, node_modules, external/, and gemini-cli are gitignored.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 14:14:09 +03:00

141 lines
3.9 KiB
Go

//go:build cgo
package main
import (
"context"
"path/filepath"
"testing"
"time"
"github.com/steveyegge/beads/internal/types"
)
// TestCreateWithNotes verifies that the --notes flag works correctly
// during issue creation in both direct mode and RPC mode.
func TestCreateWithNotes(t *testing.T) {
tmpDir := t.TempDir()
testDB := filepath.Join(tmpDir, ".beads", "beads.db")
s := newTestStore(t, testDB)
ctx := context.Background()
t.Run("DirectMode_WithNotes", func(t *testing.T) {
issue := &types.Issue{
Title: "Issue with notes",
Notes: "These are my test notes",
Priority: 1,
IssueType: types.TypeTask,
Status: types.StatusOpen,
CreatedAt: time.Now(),
}
if err := s.CreateIssue(ctx, issue, "test"); err != nil {
t.Fatalf("failed to create issue: %v", err)
}
// Retrieve and verify
retrieved, err := s.GetIssue(ctx, issue.ID)
if err != nil {
t.Fatalf("failed to retrieve issue: %v", err)
}
if retrieved.Notes != "These are my test notes" {
t.Errorf("expected notes 'These are my test notes', got %q", retrieved.Notes)
}
})
t.Run("DirectMode_WithoutNotes", func(t *testing.T) {
issue := &types.Issue{
Title: "Issue without notes",
Priority: 2,
IssueType: types.TypeBug,
Status: types.StatusOpen,
CreatedAt: time.Now(),
}
if err := s.CreateIssue(ctx, issue, "test"); err != nil {
t.Fatalf("failed to create issue: %v", err)
}
// Retrieve and verify
retrieved, err := s.GetIssue(ctx, issue.ID)
if err != nil {
t.Fatalf("failed to retrieve issue: %v", err)
}
if retrieved.Notes != "" {
t.Errorf("expected empty notes, got %q", retrieved.Notes)
}
})
t.Run("DirectMode_WithNotesAndOtherFields", func(t *testing.T) {
issue := &types.Issue{
Title: "Full issue with notes",
Description: "Detailed description",
Design: "Design notes here",
AcceptanceCriteria: "All tests pass",
Notes: "Additional implementation notes",
Priority: 1,
IssueType: types.TypeFeature,
Status: types.StatusOpen,
Assignee: "testuser",
CreatedAt: time.Now(),
}
if err := s.CreateIssue(ctx, issue, "test"); err != nil {
t.Fatalf("failed to create issue: %v", err)
}
// Retrieve and verify all fields
retrieved, err := s.GetIssue(ctx, issue.ID)
if err != nil {
t.Fatalf("failed to retrieve issue: %v", err)
}
if retrieved.Title != "Full issue with notes" {
t.Errorf("expected title 'Full issue with notes', got %q", retrieved.Title)
}
if retrieved.Description != "Detailed description" {
t.Errorf("expected description, got %q", retrieved.Description)
}
if retrieved.Design != "Design notes here" {
t.Errorf("expected design, got %q", retrieved.Design)
}
if retrieved.AcceptanceCriteria != "All tests pass" {
t.Errorf("expected acceptance criteria, got %q", retrieved.AcceptanceCriteria)
}
if retrieved.Notes != "Additional implementation notes" {
t.Errorf("expected notes 'Additional implementation notes', got %q", retrieved.Notes)
}
if retrieved.Assignee != "testuser" {
t.Errorf("expected assignee 'testuser', got %q", retrieved.Assignee)
}
})
t.Run("DirectMode_NotesWithSpecialCharacters", func(t *testing.T) {
specialNotes := "Notes with special chars: \n- Bullet point\n- Another one\n\nAnd \"quotes\" and 'apostrophes'"
issue := &types.Issue{
Title: "Issue with special char notes",
Notes: specialNotes,
Priority: 2,
IssueType: types.TypeTask,
Status: types.StatusOpen,
CreatedAt: time.Now(),
}
if err := s.CreateIssue(ctx, issue, "test"); err != nil {
t.Fatalf("failed to create issue: %v", err)
}
// Retrieve and verify
retrieved, err := s.GetIssue(ctx, issue.ID)
if err != nil {
t.Fatalf("failed to retrieve issue: %v", err)
}
if retrieved.Notes != specialNotes {
t.Errorf("notes mismatch.\nExpected: %q\nGot: %q", specialNotes, retrieved.Notes)
}
})
}