Skip to content
quarry Artifact [0661aef4fd]
Login

Artifact [0661aef4fd]

Artifact 0661aef4fd435d46e38e67e27adaed479918ad077a383ff02f7301538766ac12:


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")
	}
}