@@ -248,8 +248,8 @@ describe(testName, function() {
248248 const selectedServer = choices [ 0 ] ;
249249 expect ( selectedServer . endsWith ( '/rtmp' ) ) . to . equal ( true ) ;
250250
251- // Facebook validates the exact native URL, including its final slash.
252- // The generic form exposes that same choice without the final slash .
251+ // The Facebook catalog URL includes a final slash that the generic
252+ // form omits from the displayed choice .
253253 save ( { server : selectedServer , key : dummyKey } ) ;
254254 expectSaved ( { service : 'Facebook Live' , server : selectedServer , key : dummyKey } , `${ selectedServer } /` ) ;
255255 save ( { show_all : true } ) ;
@@ -273,6 +273,44 @@ describe(testName, function() {
273273 expectSaved ( { streamType : 'rtmp_custom' , server : youtubeServer , key : dummyKey } ) ;
274274 } ) ;
275275
276+ it ( 'Preserves the Facebook catalog URL when switching to custom streaming' , function ( ) {
277+ save ( { service : 'Facebook Live' } ) ;
278+ save ( { key : dummyKey } ) ;
279+ const formServer = field ( 'server' ) . currentValue ;
280+ const nativeServer = JSON . parse ( fs . readFileSync ( configPath , 'utf8' ) ) . settings . server ;
281+ expect ( nativeServer ) . to . equal ( `${ formServer } /` ) ;
282+
283+ save ( { streamType : 'rtmp_custom' } ) ;
284+
285+ expectSaved ( { streamType : 'rtmp_custom' , server : nativeServer , key : dummyKey } ) ;
286+
287+ // After conversion the custom field exposes the exact URL, so a
288+ // deliberate removal of its trailing slash must remain possible.
289+ save ( { server : formServer } ) ;
290+ expectSaved ( { streamType : 'rtmp_custom' , server : formServer , key : dummyKey } ) ;
291+ } ) ;
292+
293+ it ( 'Keeps an explicit replacement URL when leaving Facebook common streaming' , function ( ) {
294+ save ( { service : 'Facebook Live' } ) ;
295+ save ( { key : dummyKey } ) ;
296+ const server = 'rtmps://custom.example.invalid:443/application/' ;
297+
298+ save ( { streamType : 'rtmp_custom' , server } ) ;
299+
300+ expectSaved ( { streamType : 'rtmp_custom' , server, key : dummyKey } ) ;
301+ } ) ;
302+
303+ it ( 'Keeps an explicitly added trailing slash when switching to custom streaming' , function ( ) {
304+ save ( { service : 'YouTube - RTMPS' } ) ;
305+ save ( { server : youtubeServer , key : dummyKey } ) ;
306+ expect ( field ( 'server' ) . currentValue ) . to . equal ( youtubeServer ) ;
307+ const server = `${ youtubeServer } /` ;
308+
309+ save ( { streamType : 'rtmp_custom' , server } ) ;
310+
311+ expectSaved ( { streamType : 'rtmp_custom' , server, key : dummyKey } ) ;
312+ } ) ;
313+
276314 it ( 'Resolves the automatic Twitch server when switching to custom streaming' , function ( ) {
277315 save ( { key : dummyKey } ) ;
278316 expect ( field ( 'server' ) . currentValue ) . to . equal ( 'auto' ) ;
0 commit comments