Something went wrong. Try again.
A community based topic aggregation platform built on atproto
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374package main
import ( "testing"
"Coves/internal/config" "Coves/internal/crypto/credentialcipher/credentialciphertest"
"github.com/stretchr/testify/require")
func TestApplication_WiresCommentReplyNotifications(t *testing.T) { app := &application{cfg: &config.Config{}, credentialCipher: credentialciphertest.Fixed()} app.buildRepositories()
require.NotNil(t, app.notificationRepo, "buildRepositories must construct the notification repository") require.True(t, app.buildCommentConsumer().NotificationsWired(), "the comment consumer registered for the feed must carry the notification repository")}
// Without the bridge trust, the comment consumer would notify recipients hosted// on a trusted bridge PDS.func TestApplication_WiresCommentBridgeTrust(t *testing.T) { const trustedBridgeHost = "https://bridge.test" app := &application{ cfg: &config.Config{Instance: config.InstanceConfig{TrustedBridgePDSHosts: []string{trustedBridgeHost}}}, credentialCipher: credentialciphertest.Fixed(), } app.buildRepositories() app.buildJetstreamInfrastructure()
require.True(t, app.bridgeTrust.TrustsPDS(trustedBridgeHost), "buildJetstreamInfrastructure must build the bridge trust from the configured hosts") require.True(t, app.buildCommentConsumer().BridgeTrustWired(), "the comment consumer registered for the feed must carry the bridge trust")}
func TestApplication_WiresVoteNotificationsAndErasureGate(t *testing.T) { app := &application{cfg: &config.Config{}, credentialCipher: credentialciphertest.Fixed()} app.buildRepositories()
require.NotNil(t, app.notificationRepo, "buildRepositories must construct the notification repository") consumer := app.buildVoteConsumer() require.True(t, consumer.NotificationsWired(), "the vote consumer registered for the feed must carry the notification repository") require.True(t, consumer.ErasureGated(), "the existing erased-subject gate must remain wired")}
func TestApplication_WiresVoteBridgeTrust(t *testing.T) { const trustedBridgeHost = "https://bridge.test" app := &application{ cfg: &config.Config{Instance: config.InstanceConfig{TrustedBridgePDSHosts: []string{trustedBridgeHost}}}, credentialCipher: credentialciphertest.Fixed(), } app.buildRepositories() app.buildJetstreamInfrastructure()
require.True(t, app.bridgeTrust.TrustsPDS(trustedBridgeHost), "buildJetstreamInfrastructure must build bridge trust from the configured hosts") consumer := app.buildVoteConsumer() require.True(t, consumer.BridgeTrustWired(), "the vote consumer registered for the feed must carry bridge trust") require.True(t, consumer.ErasureGated(), "the existing erased-subject gate must remain wired")}
func TestApplication_WiresPostNotifications(t *testing.T) { app := &application{cfg: &config.Config{}, credentialCipher: credentialciphertest.Fixed()} app.buildRepositories()
require.NotNil(t, app.notificationRepo, "buildRepositories must construct the notification repository") require.True(t, app.buildPostConsumer().NotificationsWired(), "the post consumer registered for the feed must carry the notification repository")}