@@ -436,6 +436,83 @@ test('fillMirrors incorrect fields', () => {
436436 ) ;
437437} ) ;
438438
439+ test ( "fillProxies do noting if no params" , ( ) => {
440+ const xml = stringAsXml ( "<proxies/>" ) ;
441+
442+ settings . fillProxies ( xml ) ;
443+
444+ const xmlStr = new XMLSerializer ( ) . serializeToString ( xml ) ;
445+ expect ( xmlStr ) . toBe ( "<proxies/>" ) ;
446+ expect ( consoleOutput ) . toEqual ( [ ] ) ;
447+ } )
448+
449+ test ( "fillProxies one proxy" , ( ) => {
450+ const xml = stringAsXml ( "<proxies/>" ) ;
451+
452+ process . env [ 'INPUT_PROXIES' ] = `[{"id": "proxyId", "active": "isActive", "protocol": "proxyProtocol",
453+ "host": "proxyHost", "port": "proxyPort", "nonProxyHosts": "nonProxyHost"}]` ;
454+
455+ settings . fillProxies ( xml ) ;
456+
457+ const xmlStr = new XMLSerializer ( ) . serializeToString ( xml ) ;
458+ expect ( xmlStr ) . toBe ( `<proxies><proxy>
459+ <id>proxyId</id>
460+ <active>isActive</active>
461+ <protocol>proxyProtocol</protocol>
462+ <host>proxyHost</host>
463+ <port>proxyPort</port>
464+ <nonProxyHosts>nonProxyHost</nonProxyHosts>
465+ </proxy></proxies>` )
466+
467+ } )
468+
469+ test ( "fillProxies two proxies" , ( ) => {
470+ const xml = stringAsXml ( "<proxies/>" ) ;
471+
472+ process . env [ 'INPUT_PROXIES' ] = `[{"id": "proxyId1", "active": "isActive1", "protocol": "proxyProtocol1",
473+ "host": "proxyHost1", "port": "proxyPort1", "nonProxyHosts": "nonProxyHost1"},
474+ {"id": "proxyId2", "active": "isActive2", "protocol": "proxyProtocol2",
475+ "host": "proxyHost2", "port": "proxyPort2", "nonProxyHosts": "nonProxyHost2"}]` ;
476+
477+ settings . fillProxies ( xml ) ;
478+
479+ const xmlStr = new XMLSerializer ( ) . serializeToString ( xml ) ;
480+ expect ( xmlStr ) . toBe ( `<proxies><proxy>
481+ <id>proxyId1</id>
482+ <active>isActive1</active>
483+ <protocol>proxyProtocol1</protocol>
484+ <host>proxyHost1</host>
485+ <port>proxyPort1</port>
486+ <nonProxyHosts>nonProxyHost1</nonProxyHosts>
487+ </proxy><proxy>
488+ <id>proxyId2</id>
489+ <active>isActive2</active>
490+ <protocol>proxyProtocol2</protocol>
491+ <host>proxyHost2</host>
492+ <port>proxyPort2</port>
493+ <nonProxyHosts>nonProxyHost2</nonProxyHosts>
494+ </proxy></proxies>` )
495+
496+ } )
497+
498+ test ( 'fillProxies incorrect fields' , ( ) => {
499+
500+ const xml = stringAsXml ( "<proxies/>" ) ;
501+
502+ process . env [ 'INPUT_PROXIES' ] = '[{"idx": "id1"}]' ;
503+
504+ settings . fillProxies ( xml ) ;
505+
506+ const xmlStr = new XMLSerializer ( ) . serializeToString ( xml ) ;
507+
508+ expect ( xmlStr ) . toBe ( '<proxies/>' ) ;
509+ expect ( consoleOutput ) . toEqual (
510+ expect . arrayContaining ( [
511+ expect . stringMatching ( / : : e r r o r : : p r o x i e s m u s t c o n t a i n i d , a c t i v e , p r o t o c o l , h o s t , p o r t a n d n o n P r o x y H o s t s / )
512+ ] )
513+ ) ;
514+ } )
515+
439516test ( 'addApacheSnapshots' , ( ) => {
440517
441518 process . env [ 'INPUT_APACHESNAPSHOTS' ] = "true" ;
0 commit comments