@@ -4,75 +4,93 @@ describe('hash', () => {
44 test
55 . stdout ( )
66 . command ( [ 'hash' , 'ashish' ] )
7- . it ( "cdt hash 'ashish'" , ctx => {
7+ . it ( "Check default type -> cdt hash 'ashish'" , ctx => {
88 expect ( ctx . stdout ) . to . contain ( '428b6da53085b8fd7b37e9fb259c0c609bd09984' )
99 } )
1010
11+ //invalid type
12+ test
13+ . stdout ( )
14+ . command ( [ 'hash' , '-t' , 'invalid' , 'ashish' ] )
15+ . exit ( 0 )
16+ . it ( "Invalid type -> cdt hash -t invalid 'ashish'" , ctx => {
17+ expect ( ctx . stdout ) . to . contain ( 'Invalid Or Unsupported hash type' )
18+ } )
19+
20+ //empty string
21+ test
22+ . stdout ( )
23+ . command ( [ 'hash' , '-t' , 'md5' ] )
24+ . exit ( 0 )
25+ . it ( "Empty Input String -> cdt hash -t md5" , ctx => {
26+ expect ( ctx . stdout ) . to . contain ( 'Input string is empty or undefined' )
27+ } )
28+
29+
1130 // passing sha1 as option
1231 test
1332 . stdout ( )
1433 . command ( [ 'hash' , 'ashish' , '-t' , 'sha1' ] )
15- . it ( "cdt hash 'ashish' -t 'sha1'" , ctx => {
34+ . it ( "Passing Default type:sha -> cdt hash 'ashish' -t 'sha1'" , ctx => {
1635 expect ( ctx . stdout ) . to . contain ( '428b6da53085b8fd7b37e9fb259c0c609bd09984' )
1736 } )
1837
1938 //overriding string with option -s
2039 test
2140 . stdout ( )
2241 . command ( [ 'hash' , '-s' , 'ashish' ] )
23- . it ( "cdt hash -s 'ashish'" , ctx => {
42+ . it ( "Passing string with -s flag -> cdt hash -s 'ashish'" , ctx => {
2443 expect ( ctx . stdout ) . to . contain ( '428b6da53085b8fd7b37e9fb259c0c609bd09984' )
2544 } )
2645
2746 // if both passed then need to take flag value of -s
2847 test
2948 . stdout ( )
3049 . command ( [ 'hash' , 'patel' , '-s' , 'ashish' ] )
31- . it ( "cdt hash 'patel' -s 'ashish'" , ctx => {
50+ . it ( "Overriding argument string with -s flag -> cdt hash 'patel' -s 'ashish'" , ctx => {
3251 expect ( ctx . stdout ) . to . contain ( '428b6da53085b8fd7b37e9fb259c0c609bd09984' )
3352 } )
3453
3554 //sha256
3655 test
3756 . stdout ( )
3857 . command ( [ 'hash' , '-t' , 'sha256' , 'ashish' ] )
39- . it ( "cdt hash -t sha256 'ashish'" , ctx => {
58+ . it ( "Hash Sha256 -> cdt hash -t sha256 'ashish'" , ctx => {
4059 expect ( ctx . stdout ) . to . contain ( '05d08de271d2773a504b3a30f98df26cccda55689a8dc3514f55d3f247553d2b' )
4160 } )
4261
4362 //md5
4463 test
4564 . stdout ( )
4665 . command ( [ 'hash' , '--type' , 'md5' , 'ashish' ] )
47- . it ( "cdt hash --type md5 'ashish'" , ctx => {
66+ . it ( "Hash Md5 -> cdt hash --type md5 'ashish'" , ctx => {
4867 expect ( ctx . stdout ) . to . contain ( '7b69ad8a8999d4ca7c42b8a729fb0ffd' )
4968 } )
5069
5170 //sha512
5271 test
5372 . stdout ( )
5473 . command ( [ 'hash' , '--type' , 'sha512' , 'ashish' ] )
55- . it ( "cdt hash --type sha512 'ashish'" , ctx => {
74+ . it ( "Hash Sha512 -> cdt hash --type sha512 'ashish'" , ctx => {
5675 expect ( ctx . stdout ) . to . contain ( '2e076fcbd0e5dcb29d30da42a554de919864bbc29eaefe6d32c4f6bcb219d77ce5e48dada485dae92c918b10a03f42008c43ca721f06da6efa5fa9a223401907' )
5776 } )
5877
5978 //rmd160
6079 test
6180 . stdout ( )
6281 . command ( [ 'hash' , '--type' , 'rmd160' , 'ashish' ] )
63- . it ( "cdt hash --type rmd160 'ashish'" , ctx => {
82+ . it ( "Hash rmd160 -> cdt hash --type rmd160 'ashish'" , ctx => {
6483 expect ( ctx . stdout ) . to . contain ( 'a85a72b0a240abecdf27f127aa75fd8663d6d5be' )
6584 } )
6685
6786 //file input - file not found TODO: solve issue #4
68- /*
6987 test
70- .stderr ()
88+ . stdout ( )
7189 . command ( [ 'hash' , '-f' , 'test/resources/filenotfound.txt' ] )
90+ . exit ( 0 )
7291 . it ( "cdt hash -f 'test/resources/filenotfound.txt'" , ctx => {
73- expect(ctx.stderr ).to.contain('Error: reading File ')
92+ expect ( ctx . stdout ) . to . contain ( 'Could not find file ' )
7493 } )
75- */
7694
7795 //file input
7896 test
0 commit comments