package phraser

import (
	"strings"
	"testing"
)

// Every phrasing prompt must carry the shared context block. This is the
// regression guard for the bug that started this: the "ты" rule reached only
// two of the five prompts because each prompt had its own copy of the rules.
func TestEveryPromptCarriesTheContextBlock(t *testing.T) {
	block := func() string { return "CTXBLOCK" }
	p := &LLMPhraser{cfg: Config{ContextBlock: block}}

	prompts := map[string]string{
		"nudge": p.systemPrompt(),
		"query": p.querySystemPrompt(),
		"chat":  chatSystemPrompt(block),
	}
	for name, got := range prompts {
		if !strings.HasPrefix(got, "CTXBLOCK\n\n") {
			t.Errorf("%s prompt does not start with the context block:\n%s", name, got)
		}
	}
}

// Without a block the prompts are unchanged — the stub and test paths pass nil.
func TestPromptsWithoutBlockAreUnchanged(t *testing.T) {
	p := &LLMPhraser{}
	if p.systemPrompt() != nudgeSystem {
		t.Errorf("nudge prompt changed with no block set")
	}
}
