@@ -1241,8 +1241,74 @@ describe('RokuDeploy', () => {
12411241 } ) ;
12421242
12431243 it ( 'does not set appType if not explicitly defined' , async ( ) => {
1244+ delete options . appType ;
12441245 const stub = mockDoPostRequest ( ) ;
12451246
1247+ fsExtra . outputFileSync ( `${ outDir } /${ options . outFile } ` , 'asdf' ) ;
1248+
1249+ const result = await rokuDeploy . sideload ( {
1250+ host : '1.2.3.4' ,
1251+ password : 'password' ,
1252+ outDir : outDir ,
1253+ outFile : options . outFile ,
1254+ deleteDevChannel : false
1255+ } ) ;
1256+ expect ( result . message ) . to . equal ( 'Successful sideload' ) ;
1257+ expect ( stub . getCall ( 0 ) . args [ 0 ] . formData . app_type ) . to . be . undefined ;
1258+ } ) ;
1259+
1260+ it ( 'does not set appType if not appType is set to null or undefined' , async ( ) => {
1261+ const stub = mockDoPostRequest ( ) ;
1262+ fsExtra . outputFileSync ( `${ outDir } /${ options . outFile } ` , 'asdf' ) ;
1263+
1264+ const result = await rokuDeploy . sideload ( {
1265+ host : '1.2.3.4' ,
1266+ password : 'password' ,
1267+ outDir : outDir ,
1268+ outFile : options . outFile ,
1269+ deleteDevChannel : false ,
1270+ appType : null
1271+ } ) ;
1272+ expect ( result . message ) . to . equal ( 'Successful sideload' ) ;
1273+ expect ( stub . getCall ( 0 ) . args [ 0 ] . formData . app_type ) . to . be . undefined ;
1274+ } ) ;
1275+
1276+ it ( 'sets appType="channel" when defined' , async ( ) => {
1277+ const stub = mockDoPostRequest ( ) ;
1278+ fsExtra . outputFileSync ( `${ outDir } /${ options . outFile } ` , 'asdf' ) ;
1279+
1280+ const result = await rokuDeploy . sideload ( {
1281+ host : '1.2.3.4' ,
1282+ password : 'password' ,
1283+ outDir : outDir ,
1284+ outFile : options . outFile ,
1285+ deleteDevChannel : false ,
1286+ appType : 'channel'
1287+ } ) ;
1288+ expect ( result . message ) . to . equal ( 'Successful sideload' ) ;
1289+ expect ( stub . getCall ( 0 ) . args [ 0 ] . formData . app_type ) . to . eql ( 'channel' ) ;
1290+ } ) ;
1291+
1292+ it ( 'sets appType="dcl" when defined' , async ( ) => {
1293+ const stub = mockDoPostRequest ( ) ;
1294+ fsExtra . outputFileSync ( `${ outDir } /${ options . outFile } ` , 'asdf' ) ;
1295+
1296+ const result = await rokuDeploy . sideload ( {
1297+ host : '1.2.3.4' ,
1298+ password : 'password' ,
1299+ outDir : outDir ,
1300+ outFile : options . outFile ,
1301+ deleteDevChannel : false ,
1302+ appType : 'dcl'
1303+ } ) ;
1304+ expect ( result . message ) . to . equal ( 'Successful sideload' ) ;
1305+ expect ( stub . getCall ( 0 ) . args [ 0 ] . formData . app_type ) . to . eql ( 'dcl' ) ;
1306+ } ) ;
1307+
1308+ it ( 'Does not reject when response contains compile error wording but config is set to ignore compile warnings' , async ( ) => {
1309+ const stub = mockDoPostRequest ( ) ;
1310+ options . failOnCompileError = false ;
1311+
12461312 const result = await rokuDeploy . sideload ( {
12471313 host : '1.2.3.4' ,
12481314 password : 'password' ,
@@ -1606,6 +1672,7 @@ describe('RokuDeploy', () => {
16061672 <font color="red">Success.</font>
16071673 </div>` ;
16081674 mockDoPostRequest ( body ) ;
1675+
16091676 try {
16101677 fsExtra . writeFileSync ( s `notReal.pkg` , '' ) ;
16111678 await rokuDeploy . rekeyDevice ( {
@@ -2906,7 +2973,7 @@ describe('RokuDeploy', () => {
29062973 outDir : outDir
29072974 } ) ;
29082975 const data = fsExtra . readFileSync ( rokuDeploy [ 'getOutputZipFilePath' ] ( { outDir : outDir } ) ) ;
2909- const zip = await JSZip . loadAsync ( data ) ;
2976+ const zip = await JSZip . loadAsync ( data as any ) ;
29102977
29112978 const files = [ 'manifest' ] ;
29122979 for ( const file of files ) {
@@ -2934,7 +3001,7 @@ describe('RokuDeploy', () => {
29343001 await rokuDeploy . zip ( options ) ;
29353002
29363003 const data = fsExtra . readFileSync ( rokuDeploy [ 'getOutputZipFilePath' ] ( { outDir : outDir } ) ) ;
2937- const zip = await JSZip . loadAsync ( data ) ;
3004+ const zip = await JSZip . loadAsync ( data as any ) ;
29383005
29393006 for ( const file of filePaths ) {
29403007 const zipFileContents = await zip . file ( file . toString ( ) ) ?. async ( 'string' ) ;
@@ -3117,10 +3184,11 @@ describe('RokuDeploy', () => {
31173184
31183185 it ( 'Finds folder using square brackets glob pattern' , async ( ) => {
31193186 fsExtra . outputFileSync ( `${ rootDir } /e/file.brs` , '' ) ;
3120- expect ( await getFilePaths ( [
3121- '[test]/*'
3122- ] ,
3123- rootDir
3187+ expect ( await getFilePaths (
3188+ [
3189+ '[test]/*'
3190+ ] ,
3191+ rootDir
31243192 ) ) . to . eql ( [ {
31253193 src : s `${ rootDir } /e/file.brs` ,
31263194 dest : s `e/file.brs`
@@ -3130,10 +3198,11 @@ describe('RokuDeploy', () => {
31303198 it ( 'Finds folder with escaped square brackets glob pattern as name' , async ( ) => {
31313199 fsExtra . outputFileSync ( `${ rootDir } /[test]/file.brs` , '' ) ;
31323200 fsExtra . outputFileSync ( `${ rootDir } /e/file.brs` , '' ) ;
3133- expect ( await getFilePaths ( [
3134- '\\[test\\]/*'
3135- ] ,
3136- rootDir
3201+ expect ( await getFilePaths (
3202+ [
3203+ '\\[test\\]/*'
3204+ ] ,
3205+ rootDir
31373206 ) ) . to . eql ( [ {
31383207 src : s `${ rootDir } /[test]/file.brs` ,
31393208 dest : s `[test]/file.brs`
@@ -4402,4 +4471,4 @@ permission of Roku, Inc. is strictly prohibited.
44024471 </script>
44034472</body>
44044473</html>
4405- ` ;
4474+ ` ;
0 commit comments