A community based topic aggregation platform built on atproto

test(lexicon): update tests for actor and community lexicon refactoring

- Update cross-reference tests to use new defs locations
- Remove handle field from actor profile test data
- Update invalid test case to check for missing createdAt instead of handle
- Clean up test data for removed lexicons (block, saved, preferences)

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

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

+8 -1
cmd/validate-lexicon/main.go
···
// Post record types (removed - no longer exists in new structure)
// Actor definitions
-
"social.coves.actor.profile#geoLocation",
+
"social.coves.actor.defs#profileView",
+
"social.coves.actor.defs#profileViewDetailed",
+
"social.coves.actor.defs#profileStats",
+
"social.coves.actor.defs#viewerState",
// Community definitions
+
"social.coves.community.defs#communityView",
+
"social.coves.community.defs#communityViewDetailed",
+
"social.coves.community.defs#communityStats",
+
"social.coves.community.defs#viewerState",
"social.coves.community.rules#rule",
}
-5
tests/lexicon-test-data/actor/block-invalid-did.json
···
-
{
-
"$type": "social.coves.actor.block",
-
"subject": "not-a-valid-did",
-
"createdAt": "2025-01-05T09:15:00Z"
-
}
-6
tests/lexicon-test-data/actor/block-valid.json
···
-
{
-
"$type": "social.coves.actor.block",
-
"subject": "did:plc:blockeduser123",
-
"createdAt": "2025-01-05T09:15:00Z",
-
"reason": "Repeated harassment and spam"
-
}
-7
tests/lexicon-test-data/actor/preferences-invalid-enum.json
···
-
{
-
"$type": "social.coves.actor.preferences",
-
"feedPreferences": {
-
"defaultFeed": "invalid-feed-type",
-
"defaultSort": "hot"
-
}
-
}
-40
tests/lexicon-test-data/actor/preferences-valid.json
···
-
{
-
"$type": "social.coves.actor.preferences",
-
"feedPreferences": {
-
"defaultFeed": "home",
-
"defaultSort": "hot",
-
"showNSFW": false,
-
"blurNSFW": true,
-
"autoplayVideos": true,
-
"infiniteScroll": true
-
},
-
"contentFiltering": {
-
"blockedTags": ["politics", "spoilers"],
-
"blockedCommunities": ["did:plc:controversialcommunity"],
-
"mutedWords": ["spam", "scam"],
-
"languageFilter": ["en", "es"]
-
},
-
"notificationSettings": {
-
"postReplies": true,
-
"commentReplies": true,
-
"mentions": true,
-
"upvotes": false,
-
"newFollowers": true,
-
"communityInvites": true,
-
"moderatorNotifications": true
-
},
-
"privacySettings": {
-
"profileVisibility": "public",
-
"showSubscriptions": true,
-
"showSavedPosts": false,
-
"showVoteHistory": false,
-
"allowDMs": "followers"
-
},
-
"displayPreferences": {
-
"theme": "dark",
-
"compactView": false,
-
"showAvatars": true,
-
"showThumbnails": true,
-
"postsPerPage": 25
-
}
-
}
-6
tests/lexicon-test-data/actor/profile-invalid-handle-format.json
···
-
{
-
"$type": "social.coves.actor.profile",
-
"handle": "invalid handle with spaces",
-
"displayName": "Test User",
-
"createdAt": "2024-01-01T00:00:00Z"
-
}
-4
tests/lexicon-test-data/actor/profile-invalid-missing-handle.json
···
-
{
-
"$type": "social.coves.actor.profile",
-
"displayName": "Missing Required Fields"
-
}
-1
tests/lexicon-test-data/actor/profile-valid.json
···
{
"$type": "social.coves.actor.profile",
-
"handle": "alice.example.com",
"displayName": "Alice Johnson",
"bio": "Software developer passionate about open-source",
"createdAt": "2024-01-15T10:30:00Z"
-6
tests/lexicon-test-data/actor/saved-invalid-type.json
···
-
{
-
"$type": "social.coves.actor.saved",
-
"subject": "at://$1/social.coves.community.post/3k7a3dmb5bk2c",
-
"type": "article",
-
"createdAt": "2025-01-09T14:30:00Z"
-
}
-7
tests/lexicon-test-data/actor/saved-valid.json
···
-
{
-
"$type": "social.coves.actor.saved",
-
"subject": "at://$1/social.coves.community.post/3k7a3dmb5bk2c",
-
"type": "post",
-
"createdAt": "2025-01-09T14:30:00Z",
-
"note": "Great tutorial on Go concurrency patterns"
-
}
+9 -8
tests/lexicon_validation_test.go
···
// Test specific cross-references that should work
crossRefs := map[string]string{
-
"social.coves.richtext.facet#byteSlice": "byteSlice definition in facet schema",
-
"social.coves.actor.profile#geoLocation": "geoLocation definition in actor profile",
-
"social.coves.community.rules#rule": "rule definition in community rules",
+
"social.coves.richtext.facet#byteSlice": "byteSlice definition in facet schema",
+
"social.coves.community.rules#rule": "rule definition in community rules",
+
"social.coves.actor.defs#profileView": "profileView definition in actor defs",
+
"social.coves.actor.defs#profileStats": "profileStats definition in actor defs",
+
"social.coves.actor.defs#viewerState": "viewerState definition in actor defs",
+
"social.coves.community.defs#communityView": "communityView definition in community defs",
+
"social.coves.community.defs#communityStats": "communityStats definition in community defs",
}
for ref, description := range crossRefs {
···
recordType: "social.coves.actor.profile",
recordData: map[string]interface{}{
"$type": "social.coves.actor.profile",
-
"handle": "alice.example.com",
"displayName": "Alice Johnson",
"createdAt": "2024-01-15T10:30:00Z",
},
···
recordData: map[string]interface{}{
"$type": "social.coves.actor.profile",
"displayName": "Alice Johnson",
+
// Missing required createdAt
},
shouldFail: true,
-
errorContains: "required field missing: handle",
+
errorContains: "required field missing",
},
{
name: "Valid community profile",
recordType: "social.coves.community.profile",
recordData: map[string]interface{}{
"$type": "social.coves.community.profile",
-
"handle": "programming.community.coves.social",
"name": "programming",
"displayName": "Programming Community",
"createdBy": "did:plc:creator123",
"hostedBy": "did:plc:coves123",
"visibility": "public",
"moderationType": "moderator",
-
"federatedFrom": "coves",
"createdAt": "2023-12-01T08:00:00Z",
},
shouldFail: false,
···
// Test with strict validation flags
recordData := map[string]interface{}{
"$type": "social.coves.actor.profile",
-
"handle": "alice.example.com",
"displayName": "Alice Johnson",
"createdAt": "2024-01-15T10:30:00", // Missing timezone
}