@@ -51,26 +51,49 @@ function mapStringSelectMenuOptionBuildersToJson(selectMenu: StringSelectMenuBui
5151describe ( 'Select Menu Components' , ( ) => {
5252 describe ( 'Assertion Tests' , ( ) => {
5353 test ( 'GIVEN valid inputs THEN Select Menu does not throw' , ( ) => {
54- expect ( ( ) => selectMenu ( ) . setCustomId ( 'foo' ) ) . not . toThrowError ( ) ;
55- expect ( ( ) => selectMenu ( ) . setMaxValues ( 10 ) ) . not . toThrowError ( ) ;
56- expect ( ( ) => selectMenu ( ) . setMinValues ( 3 ) ) . not . toThrowError ( ) ;
57- expect ( ( ) => selectMenu ( ) . setDisabled ( true ) ) . not . toThrowError ( ) ;
58- expect ( ( ) => selectMenu ( ) . setDisabled ( ) ) . not . toThrowError ( ) ;
59- expect ( ( ) => selectMenu ( ) . setPlaceholder ( 'description' ) ) . not . toThrowError ( ) ;
54+ expect ( ( ) =>
55+ selectMenu ( ) . setCustomId ( 'foo' ) . addOptions ( { label : 'test' , value : 'test' } ) . toJSON ( ) ,
56+ ) . not . toThrowError ( ) ;
57+ expect ( ( ) =>
58+ selectMenuWithId ( ) . setMaxValues ( 10 ) . addOptions ( { label : 'test' , value : 'test' } ) . toJSON ( ) ,
59+ ) . not . toThrowError ( ) ;
60+ expect ( ( ) =>
61+ selectMenuWithId ( )
62+ . setMinValues ( 3 )
63+ . addOptions (
64+ { label : 'test1' , value : 'test1' } ,
65+ { label : 'test2' , value : 'test2' } ,
66+ { label : 'test3' , value : 'test3' } ,
67+ )
68+ . toJSON ( ) ,
69+ ) . not . toThrowError ( ) ;
70+ expect ( ( ) =>
71+ selectMenuWithId ( ) . setDisabled ( true ) . addOptions ( { label : 'test' , value : 'test' } ) . toJSON ( ) ,
72+ ) . not . toThrowError ( ) ;
73+ expect ( ( ) =>
74+ selectMenuWithId ( ) . setDisabled ( ) . addOptions ( { label : 'test' , value : 'test' } ) . toJSON ( ) ,
75+ ) . not . toThrowError ( ) ;
76+ expect ( ( ) =>
77+ selectMenuWithId ( ) . setPlaceholder ( 'description' ) . addOptions ( { label : 'test' , value : 'test' } ) . toJSON ( ) ,
78+ ) . not . toThrowError ( ) ;
6079 const option = selectMenuOption ( )
6180 . setLabel ( 'test' )
6281 . setValue ( 'test' )
6382 . setDefault ( true )
6483 . setEmoji ( { name : 'test' } )
6584 . setDescription ( 'description' ) ;
66- expect ( ( ) => selectMenu ( ) . addOptions ( option ) ) . not . toThrowError ( ) ;
67- expect ( ( ) => selectMenu ( ) . setOptions ( option ) ) . not . toThrowError ( ) ;
68- expect ( ( ) => selectMenu ( ) . setOptions ( { label : 'test' , value : 'test' } ) ) . not . toThrowError ( ) ;
69- expect ( ( ) => selectMenu ( ) . addOptions ( [ option ] ) ) . not . toThrowError ( ) ;
70- expect ( ( ) => selectMenu ( ) . setOptions ( [ option ] ) ) . not . toThrowError ( ) ;
71- expect ( ( ) => selectMenu ( ) . setOptions ( [ { label : 'test' , value : 'test' } ] ) ) . not . toThrowError ( ) ;
85+ expect ( ( ) => selectMenuWithId ( ) . addOptions ( option ) . toJSON ( ) ) . not . toThrowError ( ) ;
86+ expect ( ( ) => selectMenuWithId ( ) . setOptions ( option ) . toJSON ( ) ) . not . toThrowError ( ) ;
87+ expect ( ( ) => selectMenuWithId ( ) . setOptions ( { label : 'test' , value : 'test' } ) . toJSON ( ) ) . not . toThrowError ( ) ;
88+ expect ( ( ) => selectMenuWithId ( ) . addOptions ( [ option ] ) . toJSON ( ) ) . not . toThrowError ( ) ;
89+ expect ( ( ) => selectMenuWithId ( ) . setOptions ( [ option ] ) . toJSON ( ) ) . not . toThrowError ( ) ;
7290 expect ( ( ) =>
73- selectMenu ( )
91+ selectMenuWithId ( )
92+ . setOptions ( [ { label : 'test' , value : 'test' } ] )
93+ . toJSON ( ) ,
94+ ) . not . toThrowError ( ) ;
95+ expect ( ( ) =>
96+ selectMenuWithId ( )
7497 . addOptions ( {
7598 label : 'test' ,
7699 value : 'test' ,
@@ -90,26 +113,37 @@ describe('Select Menu Components', () => {
90113 animated : true ,
91114 } ,
92115 } ,
93- ] ) ,
116+ ] )
117+ . toJSON ( ) ,
94118 ) . not . toThrowError ( ) ;
95119
96120 const options = Array . from < APISelectMenuOption > ( { length : 25 } ) . fill ( { label : 'test' , value : 'test' } ) ;
97121
98- expect ( ( ) => selectMenu ( ) . addOptions ( ...options ) ) . not . toThrowError ( ) ;
99- expect ( ( ) => selectMenu ( ) . setOptions ( ...options ) ) . not . toThrowError ( ) ;
100- expect ( ( ) => selectMenu ( ) . addOptions ( options ) ) . not . toThrowError ( ) ;
101- expect ( ( ) => selectMenu ( ) . setOptions ( options ) ) . not . toThrowError ( ) ;
122+ expect ( ( ) =>
123+ selectMenuWithId ( )
124+ . addOptions ( ...options )
125+ . toJSON ( ) ,
126+ ) . not . toThrowError ( ) ;
127+ expect ( ( ) =>
128+ selectMenuWithId ( )
129+ . setOptions ( ...options )
130+ . toJSON ( ) ,
131+ ) . not . toThrowError ( ) ;
132+ expect ( ( ) => selectMenuWithId ( ) . addOptions ( options ) . toJSON ( ) ) . not . toThrowError ( ) ;
133+ expect ( ( ) => selectMenuWithId ( ) . setOptions ( options ) . toJSON ( ) ) . not . toThrowError ( ) ;
102134
103135 expect ( ( ) =>
104- selectMenu ( )
136+ selectMenuWithId ( )
105137 . addOptions ( { label : 'test' , value : 'test' } )
106138
107- . addOptions ( ...Array . from < APISelectMenuOption > ( { length : 24 } ) . fill ( { label : 'test' , value : 'test' } ) ) ,
139+ . addOptions ( ...Array . from < APISelectMenuOption > ( { length : 24 } ) . fill ( { label : 'test' , value : 'test' } ) )
140+ . toJSON ( ) ,
108141 ) . not . toThrowError ( ) ;
109142 expect ( ( ) =>
110- selectMenu ( )
143+ selectMenuWithId ( )
111144 . addOptions ( [ { label : 'test' , value : 'test' } ] )
112- . addOptions ( Array . from < APISelectMenuOption > ( { length : 24 } ) . fill ( { label : 'test' , value : 'test' } ) ) ,
145+ . addOptions ( Array . from < APISelectMenuOption > ( { length : 24 } ) . fill ( { label : 'test' , value : 'test' } ) )
146+ . toJSON ( ) ,
113147 ) . not . toThrowError ( ) ;
114148 } ) ;
115149
@@ -212,13 +246,17 @@ describe('Select Menu Components', () => {
212246
213247 test ( 'GIVEN valid option types THEN does not throw' , ( ) => {
214248 expect ( ( ) =>
215- selectMenu ( ) . addOptions ( {
216- label : 'test' ,
217- value : 'test' ,
218- } ) ,
249+ selectMenuWithId ( )
250+ . addOptions ( {
251+ label : 'test' ,
252+ value : 'test' ,
253+ } )
254+ . toJSON ( ) ,
219255 ) . not . toThrowError ( ) ;
220256
221- expect ( ( ) => selectMenu ( ) . addOptions ( selectMenuOption ( ) . setLabel ( 'test' ) . setValue ( 'test' ) ) ) . not . toThrowError ( ) ;
257+ expect ( ( ) =>
258+ selectMenuWithId ( ) . addOptions ( selectMenuOption ( ) . setLabel ( 'test' ) . setValue ( 'test' ) ) . toJSON ( ) ,
259+ ) . not . toThrowError ( ) ;
222260 } ) ;
223261
224262 test ( 'GIVEN valid JSON input THEN valid JSON history is correct' , ( ) => {
0 commit comments