Files
bbs/internal/server/calldetails_test.go
T
Claude 8cac5066f6 Doc comments on every function
Every function and method, tests included, has a doc comment: what it
is or does, what it returns and anything a caller needs to know.  Only
comments are added; gofmt split a few aligned blocks of one-line
functions once each had its own comment.  The generated protobuf code
is left as protoc writes it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 21:26:18 +00:00

28 lines
996 B
Go

package server
import (
"testing"
"github.com/Neo-Desktop/bbs-sec/internal/bbs"
)
// TestCallDetails: a call's log line has its rate, caller ID, the number
// as the world writes it, and where it is from (or what kind of number).
func TestCallDetails(t *testing.T) {
b := bbs.New(bbs.Settings{PhoneCountry: "GB"}, nil, nil)
for _, c := range []struct {
caller bbs.Caller
want string
}{
{bbs.Caller{Rate: "33600/31200", CallerID: "02071234567"},
": rate 33600/31200, from 02071234567 (+44 20 7123 4567), in London, United Kingdom"},
{bbs.Caller{CallerID: "08005550123"}, ": from 08005550123 (+44 800 555 0123), in United Kingdom (toll-free)"},
{bbs.Caller{CallerID: "+80012345678"}, ": from +80012345678 (+800 1234 5678), an international freephone number"},
{bbs.Caller{CallerID: "anonymous"}, ": from anonymous"},
} {
if got := callDetails(&c.caller, b.Locate(&c.caller)); got != c.want {
t.Errorf("%q:\n got %q\nwant %q", c.caller.CallerID, got, c.want)
}
}
}