go-youtubekids-client/oas_test_examples_gen_test.go
Aleksander Garin fb9fd9880e - Upgrade schema
- Add constants
- Add default
- Add set default for request payload
- Fixes
2023-08-22 17:46:51 +03:00

617 lines
15 KiB
Go

// Code generated by ogen, DO NOT EDIT.
package go_youtubekids_client
import (
"fmt"
"github.com/go-faster/errors"
"github.com/go-faster/jx"
"github.com/ogen-go/ogen/validate"
std "encoding/json"
"testing"
"github.com/stretchr/testify/require"
)
func TestAccessibility_EncodeDecode(t *testing.T) {
var typ Accessibility
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 Accessibility
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestAccessibilityData_EncodeDecode(t *testing.T) {
var typ AccessibilityData
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 AccessibilityData
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestAnchoredSectionRenderer_EncodeDecode(t *testing.T) {
var typ AnchoredSectionRenderer
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 AnchoredSectionRenderer
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestAnchoredSectionRendererContent_EncodeDecode(t *testing.T) {
var typ AnchoredSectionRendererContent
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 AnchoredSectionRendererContent
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestBrowseEndpoint_EncodeDecode(t *testing.T) {
var typ BrowseEndpoint
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 BrowseEndpoint
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestBrowseRequestPayload_EncodeDecode(t *testing.T) {
var typ BrowseRequestPayload
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 BrowseRequestPayload
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestBrowseResponsePayload_EncodeDecode(t *testing.T) {
var typ BrowseResponsePayload
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 BrowseResponsePayload
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestBrowseResponsePayloadContents_EncodeDecode(t *testing.T) {
var typ BrowseResponsePayloadContents
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 BrowseResponsePayloadContents
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestBrowseResponsePayloadHeader_EncodeDecode(t *testing.T) {
var typ BrowseResponsePayloadHeader
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 BrowseResponsePayloadHeader
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestCategoriesHeaderRenderer_EncodeDecode(t *testing.T) {
var typ CategoriesHeaderRenderer
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 CategoriesHeaderRenderer
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestCategoryAssets_EncodeDecode(t *testing.T) {
var typ CategoryAssets
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 CategoryAssets
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestCompactChannelRenderer_EncodeDecode(t *testing.T) {
var typ CompactChannelRenderer
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 CompactChannelRenderer
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestCompactChannelRendererThumbnail_EncodeDecode(t *testing.T) {
var typ CompactChannelRendererThumbnail
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 CompactChannelRendererThumbnail
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestCompactPlaylistRenderer_EncodeDecode(t *testing.T) {
var typ CompactPlaylistRenderer
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 CompactPlaylistRenderer
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestCompactPlaylistRendererSidebarThumbnailsItem_EncodeDecode(t *testing.T) {
var typ CompactPlaylistRendererSidebarThumbnailsItem
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 CompactPlaylistRendererSidebarThumbnailsItem
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestCompactPlaylistRendererThumbnail_EncodeDecode(t *testing.T) {
var typ CompactPlaylistRendererThumbnail
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 CompactPlaylistRendererThumbnail
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestCompactPlaylistRendererTvBanner_EncodeDecode(t *testing.T) {
var typ CompactPlaylistRendererTvBanner
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 CompactPlaylistRendererTvBanner
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestCompactVideoRenderer_EncodeDecode(t *testing.T) {
var typ CompactVideoRenderer
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 CompactVideoRenderer
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestCompactVideoRendererChannelThumbnail_EncodeDecode(t *testing.T) {
var typ CompactVideoRendererChannelThumbnail
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 CompactVideoRendererChannelThumbnail
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestCompactVideoRendererThumbnail_EncodeDecode(t *testing.T) {
var typ CompactVideoRendererThumbnail
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 CompactVideoRendererThumbnail
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestError_EncodeDecode(t *testing.T) {
var typ Error
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 Error
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestErrorResponsePayload_EncodeDecode(t *testing.T) {
var typ ErrorResponsePayload
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 ErrorResponsePayload
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestErrorResponsePayloadError_EncodeDecode(t *testing.T) {
var typ ErrorResponsePayloadError
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 ErrorResponsePayloadError
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestItemSectionRenderer_EncodeDecode(t *testing.T) {
var typ ItemSectionRenderer
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 ItemSectionRenderer
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestItemSectionRendererContentsItem_EncodeDecode(t *testing.T) {
var typ ItemSectionRendererContentsItem
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 ItemSectionRendererContentsItem
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestKeyStringValue_EncodeDecode(t *testing.T) {
var typ KeyStringValue
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 KeyStringValue
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestKidsAppCategorySettings_EncodeDecode(t *testing.T) {
var typ KidsAppCategorySettings
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 KidsAppCategorySettings
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestKidsAppContentSettings_EncodeDecode(t *testing.T) {
var typ KidsAppContentSettings
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 KidsAppContentSettings
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestKidsAppContentSettingsCorpusPreference_EncodeDecode(t *testing.T) {
var typ KidsAppContentSettingsCorpusPreference
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 KidsAppContentSettingsCorpusPreference
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestKidsAppContentSettingsCorpusPreference_Examples(t *testing.T) {
for i, tc := range []struct {
Input string
}{
{Input: "\"KIDS_CORPUS_PREFERENCE_TWEEN\""},
} {
tc := tc
t.Run(fmt.Sprintf("Test%d", i+1), func(t *testing.T) {
var typ KidsAppContentSettingsCorpusPreference
if err := typ.Decode(jx.DecodeStr(tc.Input)); err != nil {
if validateErr, ok := errors.Into[*validate.Error](err); ok {
t.Skipf("Validation error: %v", validateErr)
return
}
require.NoErrorf(t, err, "Input: %s", tc.Input)
}
e := jx.Encoder{}
typ.Encode(&e)
require.True(t, std.Valid(e.Bytes()), "Encoded: %s", e.Bytes())
var typ2 KidsAppContentSettingsCorpusPreference
require.NoError(t, typ2.Decode(jx.DecodeBytes(e.Bytes())))
})
}
}
func TestKidsAppContentSettingsKidsNoSearchMode_EncodeDecode(t *testing.T) {
var typ KidsAppContentSettingsKidsNoSearchMode
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 KidsAppContentSettingsKidsNoSearchMode
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestKidsAppContentSettingsKidsNoSearchMode_Examples(t *testing.T) {
for i, tc := range []struct {
Input string
}{
{Input: "\"YT_KIDS_NO_SEARCH_MODE_OFF\""},
} {
tc := tc
t.Run(fmt.Sprintf("Test%d", i+1), func(t *testing.T) {
var typ KidsAppContentSettingsKidsNoSearchMode
if err := typ.Decode(jx.DecodeStr(tc.Input)); err != nil {
if validateErr, ok := errors.Into[*validate.Error](err); ok {
t.Skipf("Validation error: %v", validateErr)
return
}
require.NoErrorf(t, err, "Input: %s", tc.Input)
}
e := jx.Encoder{}
typ.Encode(&e)
require.True(t, std.Valid(e.Bytes()), "Encoded: %s", e.Bytes())
var typ2 KidsAppContentSettingsKidsNoSearchMode
require.NoError(t, typ2.Decode(jx.DecodeBytes(e.Bytes())))
})
}
}
func TestKidsAppInfo_EncodeDecode(t *testing.T) {
var typ KidsAppInfo
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 KidsAppInfo
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestKidsVideoOwnerExtension_EncodeDecode(t *testing.T) {
var typ KidsVideoOwnerExtension
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 KidsVideoOwnerExtension
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestNavigationEndpoint_EncodeDecode(t *testing.T) {
var typ NavigationEndpoint
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 NavigationEndpoint
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestRequestClient_EncodeDecode(t *testing.T) {
var typ RequestClient
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 RequestClient
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestRequestContext_EncodeDecode(t *testing.T) {
var typ RequestContext
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 RequestContext
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestResponseContext_EncodeDecode(t *testing.T) {
var typ ResponseContext
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 ResponseContext
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestResponseContextServiceTrackingParamsItem_EncodeDecode(t *testing.T) {
var typ ResponseContextServiceTrackingParamsItem
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 ResponseContextServiceTrackingParamsItem
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestScreenAnchor_EncodeDecode(t *testing.T) {
var typ ScreenAnchor
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 ScreenAnchor
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestScreenRenderer_EncodeDecode(t *testing.T) {
var typ ScreenRenderer
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 ScreenRenderer
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestSectionListRenderer_EncodeDecode(t *testing.T) {
var typ SectionListRenderer
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 SectionListRenderer
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestSectionListRendererContentsItem_EncodeDecode(t *testing.T) {
var typ SectionListRendererContentsItem
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 SectionListRendererContentsItem
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestText_EncodeDecode(t *testing.T) {
var typ Text
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 Text
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestTextRun_EncodeDecode(t *testing.T) {
var typ TextRun
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 TextRun
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestThumbnail_EncodeDecode(t *testing.T) {
var typ Thumbnail
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 Thumbnail
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}
func TestWatchEndpoint_EncodeDecode(t *testing.T) {
var typ WatchEndpoint
typ.SetFake()
e := jx.Encoder{}
typ.Encode(&e)
data := e.Bytes()
require.True(t, std.Valid(data), "Encoded: %s", data)
var typ2 WatchEndpoint
require.NoError(t, typ2.Decode(jx.DecodeBytes(data)))
}