@@ -14,37 +14,37 @@ describe("Crypto", () => {
1414 describe ( "#new Crypto" , ( ) => {
1515 it ( "with empty config" , ( ) => {
1616 assert . throws ( ( ) =>
17- new Crypto ( { } ) , Error ( " Config not valid: paths should be an array of path element." )
17+ new Crypto ( { } ) , / C o n f i g n o t v a l i d : p a t h s s h o u l d b e a n a r r a y o f p a t h e l e m e n t ./
1818 ) ;
1919 } ) ;
2020
2121 it ( "with string config" , ( ) => {
2222 assert . throws ( ( ) =>
23- new Crypto ( "" ) , Error ( " Config not valid: config should be an object." )
23+ new Crypto ( "" ) , / C o n f i g n o t v a l i d : c o n f i g s h o u l d b e a n o b j e c t ./
2424 ) ;
2525 } ) ;
2626
2727 it ( "with wrong encoding" , ( ) => {
2828 let config = JSON . parse ( JSON . stringify ( testConfig ) ) ;
2929 config [ "dataEncoding" ] = "foo" ;
3030 assert . throws ( ( ) =>
31- new Crypto ( config ) , Error ( " Config not valid: dataEncoding should be 'hex' or 'base64'" )
31+ new Crypto ( config ) , / C o n f i g n o t v a l i d : d a t a E n c o d i n g s h o u l d b e ' h e x ' o r ' b a s e 6 4 ' /
3232 ) ;
3333 } ) ;
3434
3535 it ( "with one property not defined" , ( ) => {
3636 let config = JSON . parse ( JSON . stringify ( testConfig ) ) ;
3737 delete config [ "ivFieldName" ] ;
3838 assert . throws ( ( ) =>
39- new Crypto ( config ) , Error ( " Config not valid: please check that all the properties are defined." )
39+ new Crypto ( config ) , / C o n f i g n o t v a l i d : p l e a s e c h e c k t h a t a l l t h e p r o p e r t i e s a r e d e f i n e d ./
4040 ) ;
4141 } ) ;
4242
4343 it ( "with empty paths" , ( ) => {
4444 let config = JSON . parse ( JSON . stringify ( testConfig ) ) ;
4545 config . paths = [ ] ;
4646 assert . throws ( ( ) =>
47- new Crypto ( config ) , Error ( " Config not valid: paths should be not empty." )
47+ new Crypto ( config ) , / C o n f i g n o t v a l i d : p a t h s s h o u l d b e n o t e m p t y ./
4848 ) ;
4949 } ) ;
5050
@@ -77,7 +77,7 @@ describe("Crypto", () => {
7777 let config = JSON . parse ( JSON . stringify ( testConfigHeader ) ) ;
7878 delete config [ "ivHeaderName" ] ;
7979 assert . throws ( ( ) =>
80- new Crypto ( config ) , Error ( " Config not valid: please check that all the properties are defined." )
80+ new Crypto ( config ) , / C o n f i g n o t v a l i d : p l e a s e c h e c k t h a t a l l t h e p r o p e r t i e s a r e d e f i n e d ./
8181 ) ;
8282 } ) ;
8383 } ) ;
@@ -91,7 +91,7 @@ describe("Crypto", () => {
9191 it ( "with empty string" , ( ) => {
9292 assert . throws ( ( ) => {
9393 crypto . encryptData ( { data : "" } ) ;
94- } , Error ( " Json not valid" ) ) ;
94+ } , / J s o n n o t v a l i d / ) ;
9595 } ) ;
9696
9797 it ( "with valid object, iv and secretKey" , ( ) => {
@@ -127,13 +127,13 @@ describe("Crypto", () => {
127127 it ( "with null" , ( ) => {
128128 assert . throws ( ( ) => {
129129 crypto . decryptData ( null ) ;
130- } , Error ( " Input not valid" ) ) ;
130+ } , / I n p u t n o t v a l i d / ) ;
131131 } ) ;
132132
133133 it ( "with empty string" , ( ) => {
134134 assert . throws ( ( ) => {
135135 crypto . decryptData ( "" ) ;
136- } , Error ( " Input not valid" ) ) ;
136+ } , / I n p u t n o t v a l i d / ) ;
137137 } ) ;
138138
139139 it ( "with valid object" , ( ) => {
@@ -149,7 +149,7 @@ describe("Crypto", () => {
149149 let generateSecretKey = Crypto . __get__ ( "generateSecretKey" ) ;
150150 assert . throws ( ( ) => {
151151 generateSecretKey ( "ABC" ) ;
152- } , Error ( " Unsupported symmetric algorithm" ) ) ;
152+ } , / U n s u p p o r t e d s y m m e t r i c a l g o r i t h m / ) ;
153153 } ) ;
154154 } ) ;
155155
@@ -158,7 +158,7 @@ describe("Crypto", () => {
158158 let loadPrivateKey = Crypto . __get__ ( "loadPrivateKey" ) ;
159159 assert . throws ( ( ) => {
160160 loadPrivateKey ( "./test/res/empty.key" ) ;
161- } , Error ( " Private key content not valid" ) ) ;
161+ } , / P r i v a t e k e y c o n t e n t n o t v a l i d / ) ;
162162 } ) ;
163163 } ) ;
164164
@@ -167,7 +167,7 @@ describe("Crypto", () => {
167167 let readPublicCertificate = Crypto . __get__ ( "readPublicCertificate" ) ;
168168 assert . throws ( ( ) => {
169169 readPublicCertificate ( "./test/res/empty.key" ) ;
170- } , Error ( " Public certificate content is not valid" ) ) ;
170+ } , / P u b l i c c e r t i f i c a t e c o n t e n t i s n o t v a l i d / ) ;
171171 } ) ;
172172 } ) ;
173173
@@ -177,19 +177,19 @@ describe("Crypto", () => {
177177 it ( "not valid key" , ( ) => {
178178 assert . throws ( ( ) => {
179179 getPrivateKey ( "./test/res/empty.key" ) ;
180- } , Error ( " p12 keystore content is empty" ) ) ;
180+ } , / p 1 2 k e y s t o r e c o n t e n t i s e m p t y / ) ;
181181 } ) ;
182182
183183 it ( "empty alias" , ( ) => {
184184 assert . throws ( ( ) => {
185185 getPrivateKey ( "./test/res/test_key_container.p12" ) ;
186- } , Error ( " Key alias is not set" ) ) ;
186+ } , / K e y a l i a s i s n o t s e t / ) ;
187187 } ) ;
188188
189189 it ( "empty password" , ( ) => {
190190 assert . throws ( ( ) => {
191191 getPrivateKey ( "./test/res/test_key_container.p12" , "keyalias" ) ;
192- } , Error ( " Keystore password is not set" ) ) ;
192+ } , / K e y s t o r e p a s s w o r d i s n o t s e t / ) ;
193193 } ) ;
194194
195195 it ( "valid p12" , ( ) => {
@@ -200,7 +200,7 @@ describe("Crypto", () => {
200200 it ( "valid p12, alias not found" , ( ) => {
201201 assert . throws ( ( ) => {
202202 getPrivateKey ( "./test/res/test_key_container.p12" , "mykeyalias1" , "Password1" ) ;
203- } , Error ( " No key found for alias [mykeyalias1]" ) ) ;
203+ } , / N o k e y f o u n d f o r a l i a s \ [m y k e y a l i a s 1 \] / ) ;
204204 } ) ;
205205 } ) ;
206206
0 commit comments