@@ -59,72 +59,89 @@ describe('embark.Config', function () {
5959
6060 describe ( '#getExternalContractUrl' , function ( ) {
6161 it ( 'should get the right url for a https://github file' , function ( ) {
62- const url = config . getExternalContractUrl (
62+ const fileObj = config . getExternalContractUrl (
6363 { file : 'https://github.com/embark-framework/embark/blob/master/test_app/app/contracts/simple_storage.sol' }
6464 ) ;
65- assert . strictEqual ( url ,
66- 'https://raw.githubusercontent.com/embark-framework/embark/master/test_app/app/contracts/simple_storage.sol' ) ;
65+ assert . deepEqual ( fileObj ,
66+ {
67+ filePath : 'embark-framework/embark/master/test_app/app/contracts/simple_storage.sol' ,
68+ url : 'https://raw.githubusercontent.com/embark-framework/embark/master/test_app/app/contracts/simple_storage.sol'
69+ } ) ;
6770 } ) ;
6871
6972 it ( 'should fail for a malformed https://github file' , function ( ) {
70- const url = config . getExternalContractUrl (
73+ const fileObj = config . getExternalContractUrl (
7174 { file : 'https://github/embark-framework/embark/blob/master/test_app/app/contracts/simple_storage.sol' }
7275 ) ;
73- assert . strictEqual ( url , '' ) ;
76+ assert . strictEqual ( fileObj , null ) ;
7477 } ) ;
7578
7679 it ( 'should get the right url for a git:// file with no branch #' , function ( ) {
77- const url = config . getExternalContractUrl (
80+ const fileObj = config . getExternalContractUrl (
7881 { file : 'git://github.com/status-im/contracts/contracts/identity/ERC725.sol' }
7982 ) ;
80- console . log ( url ) ;
81- assert . strictEqual ( url ,
82- 'https://raw.githubusercontent.com/status-im/contracts/master/contracts/identity/ERC725.sol' ) ;
83+ assert . deepEqual ( fileObj ,
84+ {
85+ filePath : 'status-im/contracts/master/contracts/identity/ERC725.sol' ,
86+ url : 'https://raw.githubusercontent.com/status-im/contracts/master/contracts/identity/ERC725.sol'
87+ } ) ;
8388 } ) ;
8489
8590 it ( 'should get the right url for a git:// file with a branch #' , function ( ) {
86- const url = config . getExternalContractUrl (
91+ const fileObj = config . getExternalContractUrl (
8792 { file : 'git://github.com/status-im/contracts/contracts/identity/ERC725.sol#myBranch' }
8893 ) ;
89- assert . strictEqual ( url ,
90- 'https://raw.githubusercontent.com/status-im/contracts/myBranch/contracts/identity/ERC725.sol' ) ;
94+ assert . deepEqual ( fileObj ,
95+ {
96+ filePath : 'status-im/contracts/myBranch/contracts/identity/ERC725.sol' ,
97+ url : 'https://raw.githubusercontent.com/status-im/contracts/myBranch/contracts/identity/ERC725.sol'
98+ } ) ;
9199 } ) ;
92100
93101 it ( 'should fail when the git:// file is malformed' , function ( ) {
94- const url = config . getExternalContractUrl (
102+ const fileObj = config . getExternalContractUrl (
95103 { file : 'git://github.com/identity/ERC725.sol#myBranch' }
96104 ) ;
97- assert . strictEqual ( url , '' ) ;
105+ assert . strictEqual ( fileObj , null ) ;
98106 } ) ;
99107
100108 it ( 'should get the right url with a github.com file without branch #' , function ( ) {
101- const url = config . getExternalContractUrl (
109+ const fileObj = config . getExternalContractUrl (
102110 { file : 'github.com/status-im/contracts/contracts/identity/ERC725.sol' }
103111 ) ;
104- assert . strictEqual ( url ,
105- 'https://raw.githubusercontent.com/status-im/contracts/master/contracts/identity/ERC725.sol' ) ;
112+ assert . deepEqual ( fileObj ,
113+ {
114+ filePath : 'status-im/contracts/master/contracts/identity/ERC725.sol' ,
115+ url : 'https://raw.githubusercontent.com/status-im/contracts/master/contracts/identity/ERC725.sol'
116+ } ) ;
106117 } ) ;
107118
108119 it ( 'should get the right url with a github.com file with branch #' , function ( ) {
109- const url = config . getExternalContractUrl (
120+ const fileObj = config . getExternalContractUrl (
110121 { file : 'github.com/status-im/contracts/contracts/identity/ERC725.sol#theBranch' }
111122 ) ;
112- assert . strictEqual ( url ,
113- 'https://raw.githubusercontent.com/status-im/contracts/theBranch/contracts/identity/ERC725.sol' ) ;
123+ assert . deepEqual ( fileObj ,
124+ {
125+ filePath : 'status-im/contracts/theBranch/contracts/identity/ERC725.sol' ,
126+ url : 'https://raw.githubusercontent.com/status-im/contracts/theBranch/contracts/identity/ERC725.sol'
127+ } ) ;
114128 } ) ;
115129
116130 it ( 'should fail with a malformed github.com url' , function ( ) {
117- const url = config . getExternalContractUrl (
131+ const fileObj = config . getExternalContractUrl (
118132 { file : 'github/status-im/contracts/contracts/identity/ERC725.sol#theBranch' }
119133 ) ;
120- assert . strictEqual ( url , '' ) ;
134+ assert . strictEqual ( fileObj , null ) ;
121135 } ) ;
122136
123137 it ( 'should succeed with a generic http url' , function ( ) {
124- const url = config . getExternalContractUrl (
138+ const fileObj = config . getExternalContractUrl (
125139 { file : 'http://myurl.com/myFile.sol' }
126140 ) ;
127- assert . strictEqual ( url , 'http://myurl.com/myFile.sol' ) ;
141+ assert . deepEqual ( fileObj , {
142+ filePath : 'myFile.sol' ,
143+ url : 'http://myurl.com/myFile.sol'
144+ } ) ;
128145 } ) ;
129146 } ) ;
130147
0 commit comments