7a04f298d2
- update to latest telegram layer - remove some references to fields in tg.Entities that don't exist in the schema - originally added here: https://github.com/beeper/td/commit/820929062a2ba0104397bc01235ab58a9cff780e - referenced here - https://github.com/mautrix/telegramgo/commit/124f0967ed195b5a380c9bd02e170ada9710dde3 - https://github.com/mautrix/telegramgo/commit/4205047aab2e0639217148b5d125bfaab668bd8e
50 lines
898 B
Go
50 lines
898 B
Go
package tdp_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tdp"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tdp/internal/schema"
|
|
)
|
|
|
|
func TestFormat(t *testing.T) {
|
|
for _, tt := range []struct {
|
|
Input tdp.Object
|
|
Output string
|
|
Options []tdp.Option
|
|
}{
|
|
{
|
|
Output: "<nil>",
|
|
},
|
|
{
|
|
Input: &schema.DCOption{
|
|
ID: 10,
|
|
IPAddress: "127.0.0.1",
|
|
Port: 1010,
|
|
},
|
|
Options: []tdp.Option{tdp.WithTypeID},
|
|
Output: "dcOption#18b7a10d",
|
|
},
|
|
|
|
{
|
|
Input: &schema.Config{
|
|
DCOptions: []schema.DCOption{
|
|
{
|
|
ID: 1,
|
|
IPAddress: "127.0.0.1",
|
|
Port: 1010,
|
|
},
|
|
},
|
|
},
|
|
Options: []tdp.Option{tdp.WithTypeID},
|
|
},
|
|
} {
|
|
t.Skip("TODO: Use golden files")
|
|
t.Run(tt.Output, func(t *testing.T) {
|
|
require.Equal(t, tt.Output, tdp.Format(tt.Input, tt.Options...))
|
|
})
|
|
}
|
|
}
|