+283
tests/integration/community_credentials_test.go
···+// TestCommunityRepository_CredentialPersistence tests that PDS credentials are properly persisted+t.Errorf("Decrypted access token mismatch: expected %s, got %s", accessToken, retrieved.PDSAccessToken)+t.Errorf("Decrypted refresh token mismatch: expected %s, got %s", refreshToken, retrieved.PDSRefreshToken)+specialToken := "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2NvdmVzLnNvY2lhbCIsInN1YiI6ImRpZDpwbGM6YWJjMTIzIiwiaWF0IjoxNzA5MjQwMDAwfQ.special/chars+here=="+t.Errorf("Special characters not preserved during encryption/decryption: expected %s, got %s", specialToken, retrieved.PDSAccessToken)+t.Errorf("V2 community should be self-owned: expected OwnerDID=%s, got %s", created.DID, created.OwnerDID)+t.Errorf("V2 community should be self-owned after retrieval: expected OwnerDID=%s, got %s", retrieved.DID, retrieved.OwnerDID)
+276
-56
tests/integration/community_e2e_test.go
·········-communityService := communities.NewCommunityService(communityRepo, didGen, pdsURL, instanceDID)+communityService := communities.NewCommunityService(communityRepo, didGen, pdsURL, instanceDID, instanceDomain, provisioner)······getRecordURL := fmt.Sprintf("%s/xrpc/com.atproto.repo.getRecord?repo=%s&collection=%s&rkey=%s",···+jetstreamURL := fmt.Sprintf("ws://%s:6008/subscribe?wantedCollections=social.coves.community.profile",+err := subscribeToJetstream(ctx, jetstreamURL, community.DID, consumer, eventChan, errorChan, done)···func createAndIndexCommunity(t *testing.T, service communities.Service, consumer *jetstream.CommunityEventConsumer, instanceDID string) *communities.Community {···+// communityTestIdentityResolver is a simple mock for testing (renamed to avoid conflict with oauth_test)+func (m *communityTestIdentityResolver) ResolveHandle(ctx context.Context, handle string) (string, string, error) {+func (m *communityTestIdentityResolver) ResolveDID(ctx context.Context, did string) (*identity.DIDDocument, error) {+func (m *communityTestIdentityResolver) Resolve(ctx context.Context, identifier string) (*identity.Identity, error) {+resp, err := http.Get(fmt.Sprintf("%s/xrpc/com.atproto.identity.resolveHandle?handle=%s", pdsURL, handle))
+289
tests/integration/community_v2_validation_test.go
···+// TestCommunityConsumer_V2RKeyValidation tests that only V2 communities (rkey="self") are accepted+t.Errorf("V2 community should be self-owned: expected OwnerDID=%s, got %s", community.DID, community.OwnerDID)+if errMsg != "invalid community profile rkey: expected 'self', got '3k2j4h5g6f7d' (V1 communities not supported)" {+t.Errorf("V1 community should not have been indexed, expected ErrCommunityNotFound, got: %v", err)
+325
tests/unit/community_service_test.go
···+func (m *mockCommunityRepo) Create(ctx context.Context, community *communities.Community) (*communities.Community, error) {+func (m *mockCommunityRepo) GetByDID(ctx context.Context, did string) (*communities.Community, error) {+func (m *mockCommunityRepo) GetByHandle(ctx context.Context, handle string) (*communities.Community, error) {+func (m *mockCommunityRepo) Update(ctx context.Context, community *communities.Community) (*communities.Community, error) {+func (m *mockCommunityRepo) List(ctx context.Context, req communities.ListCommunitiesRequest) ([]*communities.Community, int, error) {+func (m *mockCommunityRepo) Search(ctx context.Context, req communities.SearchCommunitiesRequest) ([]*communities.Community, int, error) {+func (m *mockCommunityRepo) Subscribe(ctx context.Context, subscription *communities.Subscription) (*communities.Subscription, error) {+func (m *mockCommunityRepo) SubscribeWithCount(ctx context.Context, subscription *communities.Subscription) (*communities.Subscription, error) {+func (m *mockCommunityRepo) Unsubscribe(ctx context.Context, userDID, communityDID string) error {+func (m *mockCommunityRepo) UnsubscribeWithCount(ctx context.Context, userDID, communityDID string) error {+func (m *mockCommunityRepo) GetSubscription(ctx context.Context, userDID, communityDID string) (*communities.Subscription, error) {+func (m *mockCommunityRepo) ListSubscriptions(ctx context.Context, userDID string, limit, offset int) ([]*communities.Subscription, error) {+func (m *mockCommunityRepo) ListSubscribers(ctx context.Context, communityDID string, limit, offset int) ([]*communities.Subscription, error) {+func (m *mockCommunityRepo) CreateMembership(ctx context.Context, membership *communities.Membership) (*communities.Membership, error) {+func (m *mockCommunityRepo) GetMembership(ctx context.Context, userDID, communityDID string) (*communities.Membership, error) {+func (m *mockCommunityRepo) UpdateMembership(ctx context.Context, membership *communities.Membership) (*communities.Membership, error) {+func (m *mockCommunityRepo) ListMembers(ctx context.Context, communityDID string, limit, offset int) ([]*communities.Membership, error) {+func (m *mockCommunityRepo) CreateModerationAction(ctx context.Context, action *communities.ModerationAction) (*communities.ModerationAction, error) {+func (m *mockCommunityRepo) ListModerationActions(ctx context.Context, communityDID string, limit, offset int) ([]*communities.ModerationAction, error) {+func (m *mockCommunityRepo) IncrementMemberCount(ctx context.Context, communityDID string) error {+func (m *mockCommunityRepo) DecrementMemberCount(ctx context.Context, communityDID string) error {+func (m *mockCommunityRepo) IncrementSubscriberCount(ctx context.Context, communityDID string) error {+func (m *mockCommunityRepo) DecrementSubscriberCount(ctx context.Context, communityDID string) error {+func (m *mockCommunityRepo) IncrementPostCount(ctx context.Context, communityDID string) error {+// TestCommunityService_UpdateWithCredentials tests that UpdateCommunity uses community credentials+w.Write([]byte(`{"uri":"at://did:plc:community/social.coves.community.profile/self","cid":"bafyrei456"}`))