@@ -52,6 +52,31 @@ describe('cmdLine', function () {
52
52
const result = this . cmdLine . getFirstRunPromoCode ( args )
53
53
assert . equal ( result , promoCode )
54
54
} )
55
+
56
+ it ( 'finds and parses promo code when we have multiple downloads' , function ( ) {
57
+ const promoCode = 'pem001 (1)'
58
+ const validPromoCodeInstallerPath = `d:\\my\\location\\on-disk\\in-a-folder-tes301\\Setup-Brave-x64-${ promoCode } .exe`
59
+ const args = [ ...initialArgs , key , validPromoCodeInstallerPath , '--other' , 'arg' , '--and-another' ]
60
+ const result = this . cmdLine . getFirstRunPromoCode ( args )
61
+ assert . equal ( result , 'pem001' )
62
+ } )
63
+
64
+ it ( 'finds and parses promo code 2' , function ( ) {
65
+ const promoCode = 'org-name'
66
+ const validPromoCodeInstallerPath = `d:\\my\\location\\on-disk\\in-a-folder-tes301\\Setup-Brave-x64-${ promoCode } .exe`
67
+ const args = [ ...initialArgs , key , validPromoCodeInstallerPath , '--other' , 'arg' , '--and-another' ]
68
+ const result = this . cmdLine . getFirstRunPromoCode ( args )
69
+ assert . equal ( result , promoCode )
70
+ } )
71
+
72
+ it ( 'finds and parses promo code 2 when we have multiple downloads' , function ( ) {
73
+ const promoCode = 'org-name (1)'
74
+ const validPromoCodeInstallerPath = `d:\\my\\location\\on-disk\\in-a-folder-tes301\\Setup-Brave-x64-${ promoCode } .exe`
75
+ const args = [ ...initialArgs , key , validPromoCodeInstallerPath , '--other' , 'arg' , '--and-another' ]
76
+ const result = this . cmdLine . getFirstRunPromoCode ( args )
77
+ assert . equal ( result , 'org-name' )
78
+ } )
79
+
55
80
it ( `does not find promo code when there isn't one` , function ( ) {
56
81
const noPromoCodeInstallerPath = `d:\\my\\location\\on-disk\\in-a-folder-tes301\\Setup-Brave-x64.exe`
57
82
const args = [ ...initialArgs , key , noPromoCodeInstallerPath , '--other' , 'arg' , '--and-another' ]
0 commit comments