package api
import (
"context"
"strings"
"testing"
"craftdesign.group/quarry/internal/ops"
)
type letterCaps string
func (l letterCaps) HasAny(s string) bool { return strings.ContainsAny(s, string(l)) }
// The CI letter decides whether CI facts travel with an answer. With no
// capability plane at all nothing is hidden: that forge has no readers
// to hide from.
func TestCIFactsFollowTheLetter(t *testing.T) {
bare := context.Background()
if hideCI(bare) {
t.Fatal("no plane, yet CI hidden")
}
if hideCI(ops.WithCaps(bare, letterCaps("o8"))) {
t.Fatal("holder of 8 hidden")
}
if !hideCI(ops.WithCaps(bare, letterCaps("ogjorz"))) {
t.Fatal("reader without 8 still sees CI")
}
}