A community based topic aggregation platform built on atproto

test: update integration tests for .community. handle format

Update all integration tests to use singular .community. naming convention
instead of .communities.

Tests updated:
- E2E community creation and XRPC endpoint tests
- HostedBy security validation tests
- Community provisioning tests
- Service integration tests
- V2 validation tests
- Token refresh tests

Changes:
- Update expected handle formats in assertions
- Update test fixtures to use new convention
- Ensure regex patterns match .community. format

All tests passing with new handle format.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

+3 -3
tests/integration/community_e2e_test.go
···
// ====================================================================================
t.Run("1. Write-Forward to PDS", func(t *testing.T) {
// Use shorter names to avoid "Handle too long" errors
-
// atProto handles max: 63 chars, format: name.communities.coves.social
+
// atProto handles max: 63 chars, format: name.community.coves.social
communityName := fmt.Sprintf("e2e-%d", time.Now().Unix())
createReq := communities.CreateCommunityRequest{
···
// V2: Verify PDS account was created for the community
t.Logf("\n🔍 V2: Verifying community PDS account exists...")
-
expectedHandle := fmt.Sprintf("%s.communities.%s", communityName, instanceDomain)
+
expectedHandle := fmt.Sprintf("%s.community.%s", communityName, instanceDomain)
t.Logf(" Expected handle: %s", expectedHandle)
-
t.Logf(" (Using subdomain: *.communities.%s)", instanceDomain)
+
t.Logf(" (Using subdomain: *.community.%s)", instanceDomain)
accountDID, accountHandle, err := queryPDSAccount(pdsURL, expectedHandle)
if err != nil {
+12 -12
tests/integration/community_hostedby_security_test.go
···
RKey: "self",
CID: "bafy123abc",
Record: map[string]interface{}{
-
"handle": "gaming.communities.coves.social", // coves.social handle
+
"handle": "gaming.community.coves.social", // coves.social handle
"name": "gaming",
"displayName": "Nintendo Gaming",
"description": "Fake Nintendo community",
···
RKey: "self",
CID: "bafy123abc",
Record: map[string]interface{}{
-
"handle": "gaming.communities.coves.social", // coves.social handle
+
"handle": "gaming.community.coves.social", // coves.social handle
"name": "gaming",
"displayName": "Gaming Community",
"description": "Legitimate coves.social community",
···
RKey: "self",
CID: "bafy123abc",
Record: map[string]interface{}{
-
"handle": "gaming.communities.coves.social",
+
"handle": "gaming.community.coves.social",
"name": "gaming",
"displayName": "Test Community",
"description": "Test",
···
RKey: "self",
CID: "bafy123abc",
Record: map[string]interface{}{
-
"handle": "gaming.communities.example.com",
+
"handle": "gaming.community.example.com",
"name": "gaming",
"displayName": "Test",
"description": "Test",
···
}{
{
name: "DNS-style handle with subdomain",
-
handle: "gaming.communities.coves.social",
+
handle: "gaming.community.coves.social",
hostedByDID: "did:web:coves.social",
shouldSucceed: true,
},
···
},
{
name: "Multi-part subdomain",
-
handle: "gaming.test.communities.example.com",
+
handle: "gaming.test.community.example.com",
hostedByDID: "did:web:example.com",
shouldSucceed: true,
},
{
name: "Mismatched domain",
-
handle: "gaming.communities.coves.social",
+
handle: "gaming.community.coves.social",
hostedByDID: "did:web:example.com",
shouldSucceed: false,
},
// CRITICAL: Multi-part TLD tests (PR review feedback)
{
name: "Multi-part TLD: .co.uk",
-
handle: "gaming.communities.coves.co.uk",
+
handle: "gaming.community.coves.co.uk",
hostedByDID: "did:web:coves.co.uk",
shouldSucceed: true,
},
{
name: "Multi-part TLD: .com.au",
-
handle: "gaming.communities.example.com.au",
+
handle: "gaming.community.example.com.au",
hostedByDID: "did:web:example.com.au",
shouldSucceed: true,
},
{
name: "Multi-part TLD: Reject incorrect .co.uk extraction",
-
handle: "gaming.communities.coves.co.uk",
+
handle: "gaming.community.coves.co.uk",
hostedByDID: "did:web:co.uk", // Wrong! Should be coves.co.uk
shouldSucceed: false,
},
{
name: "Multi-part TLD: .org.uk",
-
handle: "gaming.communities.myinstance.org.uk",
+
handle: "gaming.community.myinstance.org.uk",
hostedByDID: "did:web:myinstance.org.uk",
shouldSucceed: true,
},
{
name: "Multi-part TLD: .ac.uk",
-
handle: "gaming.communities.university.ac.uk",
+
handle: "gaming.community.university.ac.uk",
hostedByDID: "did:web:university.ac.uk",
shouldSucceed: true,
},
+9 -9
tests/integration/community_provisioning_test.go
···
community := &communities.Community{
DID: generateTestDID(uniqueSuffix),
-
Handle: fmt.Sprintf("test-encryption-%s.communities.test.local", uniqueSuffix),
+
Handle: fmt.Sprintf("test-encryption-%s.community.test.local", uniqueSuffix),
Name: "test-encryption",
DisplayName: "Test Encryption",
Description: "Testing password encryption",
···
community := &communities.Community{
DID: generateTestDID(uniqueSuffix),
-
Handle: fmt.Sprintf("test-empty-pass-%s.communities.test.local", uniqueSuffix),
+
Handle: fmt.Sprintf("test-empty-pass-%s.community.test.local", uniqueSuffix),
Name: "test-empty-pass",
DisplayName: "Test Empty Password",
Description: "Testing empty password handling",
···
community := &communities.Community{
DID: generateTestDID(uniqueSuffix),
-
Handle: fmt.Sprintf("pwd-unique-%s.communities.test.local", uniqueSuffix),
+
Handle: fmt.Sprintf("pwd-unique-%s.community.test.local", uniqueSuffix),
Name: fmt.Sprintf("pwd-unique-%s", uniqueSuffix),
DisplayName: fmt.Sprintf("Password Unique Test %d", i),
Description: "Testing password uniqueness",
···
community := &communities.Community{
DID: generateTestDID(uniqueSuffix),
-
Handle: fmt.Sprintf("test-pwd-len-%s.communities.test.local", uniqueSuffix),
+
Handle: fmt.Sprintf("test-pwd-len-%s.community.test.local", uniqueSuffix),
Name: "test-pwd-len",
DisplayName: "Test Password Length",
Description: "Testing password length requirements",
···
uniqueSuffix := fmt.Sprintf("%d-%d", time.Now().UnixNano(), idx)
community := &communities.Community{
DID: generateTestDID(uniqueSuffix),
-
Handle: fmt.Sprintf("%s.communities.test.local", sameName),
+
Handle: fmt.Sprintf("%s.community.test.local", sameName),
Name: sameName,
DisplayName: "Concurrent Test",
Description: "Testing concurrent creation",
···
uniqueSuffix := fmt.Sprintf("%d", time.Now().UnixNano())
community := &communities.Community{
DID: generateTestDID(uniqueSuffix),
-
Handle: fmt.Sprintf("read-test-%s.communities.test.local", uniqueSuffix),
+
Handle: fmt.Sprintf("read-test-%s.community.test.local", uniqueSuffix),
Name: "read-test",
DisplayName: "Read Test",
Description: "Testing concurrent reads",
···
community := &communities.Community{
DID: generateTestDID(uniqueSuffix),
-
Handle: fmt.Sprintf("token-test-%s.communities.test.local", uniqueSuffix),
+
Handle: fmt.Sprintf("token-test-%s.community.test.local", uniqueSuffix),
Name: "token-test",
DisplayName: "Token Test",
Description: "Testing token storage",
···
community := &communities.Community{
DID: generateTestDID(uniqueSuffix),
-
Handle: fmt.Sprintf("empty-token-%s.communities.test.local", uniqueSuffix),
+
Handle: fmt.Sprintf("empty-token-%s.community.test.local", uniqueSuffix),
Name: "empty-token",
DisplayName: "Empty Token Test",
Description: "Testing empty token handling",
···
community := &communities.Community{
DID: generateTestDID(uniqueSuffix),
-
Handle: fmt.Sprintf("encrypted-token-%s.communities.test.local", uniqueSuffix),
+
Handle: fmt.Sprintf("encrypted-token-%s.community.test.local", uniqueSuffix),
Name: "encrypted-token",
DisplayName: "Encrypted Token Test",
Description: "Testing token encryption",
+2 -2
tests/integration/community_service_integration_test.go
···
t.Run("creates community with real PDS provisioning", func(t *testing.T) {
// Create provisioner and service (production code path)
-
// Use coves.social domain (configured in PDS_SERVICE_HANDLE_DOMAINS as .communities.coves.social)
+
// Use coves.social domain (configured in PDS_SERVICE_HANDLE_DOMAINS as .community.coves.social)
provisioner := communities.NewPDSAccountProvisioner("coves.social", pdsURL)
service := communities.NewCommunityService(
repo,
···
t.Logf("✅ Real DID generated: %s", community.DID)
// Verify handle format
-
expectedHandle := fmt.Sprintf("%s.communities.coves.social", uniqueName)
+
expectedHandle := fmt.Sprintf("%s.community.coves.social", uniqueName)
if community.Handle != expectedHandle {
t.Errorf("Expected handle %s, got %s", expectedHandle, community.Handle)
}
+8 -8
tests/integration/community_v2_validation_test.go
···
CID: "bafyreigaming123",
Record: map[string]interface{}{
"$type": "social.coves.community.profile",
-
"handle": "gaming.communities.coves.social",
+
"handle": "gaming.community.coves.social",
"name": "gaming",
"createdBy": "did:plc:user123",
"hostedBy": "did:web:coves.social",
···
CID: "bafyreiv1community",
Record: map[string]interface{}{
"$type": "social.coves.community.profile",
-
"handle": "v1community.communities.coves.social",
+
"handle": "v1community.community.coves.social",
"name": "v1community",
"createdBy": "did:plc:user456",
"hostedBy": "did:web:coves.social",
···
CID: "bafyreicustom",
Record: map[string]interface{}{
"$type": "social.coves.community.profile",
-
"handle": "custom.communities.coves.social",
+
"handle": "custom.community.coves.social",
"name": "custom",
"createdBy": "did:plc:user789",
"hostedBy": "did:web:coves.social",
···
CID: "bafyreiupdate1",
Record: map[string]interface{}{
"$type": "social.coves.community.profile",
-
"handle": "updatetest.communities.coves.social",
+
"handle": "updatetest.community.coves.social",
"name": "updatetest",
"createdBy": "did:plc:userUpdate",
"hostedBy": "did:web:coves.social",
···
CID: "bafyreiupdate2",
Record: map[string]interface{}{
"$type": "social.coves.community.profile",
-
"handle": "updatetest.communities.coves.social",
+
"handle": "updatetest.community.coves.social",
"name": "updatetest",
"displayName": "Updated Name",
"createdBy": "did:plc:userUpdate",
···
CID: "bafyreihandle",
Record: map[string]interface{}{
"$type": "social.coves.community.profile",
-
"handle": "gamingtest.communities.coves.social", // atProto handle (DNS-resolvable)
+
"handle": "gamingtest.community.coves.social", // atProto handle (DNS-resolvable)
"name": "gamingtest", // Short name for !mentions
"createdBy": "did:plc:user123",
"hostedBy": "did:web:coves.social",
···
}
// Verify the atProto handle is stored
-
if community.Handle != "gamingtest.communities.coves.social" {
-
t.Errorf("Expected handle gamingtest.communities.coves.social, got %s", community.Handle)
+
if community.Handle != "gamingtest.community.coves.social" {
+
t.Errorf("Expected handle gamingtest.community.coves.social, got %s", community.Handle)
}
// Note: The DID is the authoritative identifier for atProto resolution
+2 -2
tests/integration/token_refresh_test.go
···
// Create a test community first
community := &communities.Community{
DID: "did:plc:test123",
-
Handle: "test.communities.coves.social",
+
Handle: "test.community.coves.social",
Name: "test",
OwnerDID: "did:plc:test123",
CreatedByDID: "did:plc:creator",
···
community := &communities.Community{
DID: "did:plc:expiring123",
-
Handle: "expiring.communities.coves.social",
+
Handle: "expiring.community.coves.social",
Name: "expiring",
OwnerDID: "did:plc:expiring123",
CreatedByDID: "did:plc:creator",