Files
mautrix-telegram/pkg/gotd/telegram/peers/invite_link_test.go
T
2025-06-27 20:03:37 -07:00

34 lines
740 B
Go

package peers
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestInviteLinkGetters(t *testing.T) {
a := require.New(t)
testExported := testChatInviteExported()
replacer := testExported
replacer.Link += "/aboba"
link := InviteLink{
raw: *testExported,
newInvite: *replacer,
}
a.Equal(testExported, link.Raw())
{
replacedWith, ok := link.ReplacedWith()
a.True(ok)
a.Equal(replacer, replacedWith.Raw())
}
a.Equal(testExported.Revoked, link.Revoked())
a.Equal(testExported.Permanent, link.Permanent())
a.Equal(testExported.RequestNeeded, link.RequestNeeded())
a.Equal(testExported.Link, link.Link())
{
date, _ := link.ExpireDate()
a.Equal(testExported.ExpireDate, int(date.Unix()))
}
}