@@ -3,15 +3,64 @@ import {expect, test} from '@oclif/test'
33describe ( 'hash' , ( ) => {
44 test
55 . stdout ( )
6- . command ( [ 'hash' ] )
7- . it ( 'runs hello' , ctx => {
8- expect ( ctx . stdout ) . to . contain ( 'hello world ' )
6+ . command ( [ 'hash' , 'ashish' ] )
7+ . it ( "cdt hash 'ashish'" , ctx => {
8+ expect ( ctx . stdout ) . to . contain ( '428b6da53085b8fd7b37e9fb259c0c609bd09984 ' )
99 } )
1010
11+ // passing sha1 as option
1112 test
1213 . stdout ( )
13- . command ( [ 'hash' , '--name' , 'jeff' ] )
14- . it ( 'runs hello --name jeff' , ctx => {
15- expect ( ctx . stdout ) . to . contain ( 'hello jeff' )
14+ . command ( [ 'hash' , 'ashish' , '-t' , 'sha1' ] )
15+ . it ( "cdt hash 'ashish' -t 'sha1'" , ctx => {
16+ expect ( ctx . stdout ) . to . contain ( '428b6da53085b8fd7b37e9fb259c0c609bd09984' )
17+ } )
18+
19+ //overriding string with option -s
20+ test
21+ . stdout ( )
22+ . command ( [ 'hash' , '-s' , 'ashish' ] )
23+ . it ( "cdt hash -s 'ashish'" , ctx => {
24+ expect ( ctx . stdout ) . to . contain ( '428b6da53085b8fd7b37e9fb259c0c609bd09984' )
25+ } )
26+
27+ // if both passed then need to take flag value of -s
28+ test
29+ . stdout ( )
30+ . command ( [ 'hash' , 'patel' , '-s' , 'ashish' ] )
31+ . it ( "cdt hash 'patel' -s 'ashish'" , ctx => {
32+ expect ( ctx . stdout ) . to . contain ( '428b6da53085b8fd7b37e9fb259c0c609bd09984' )
33+ } )
34+
35+ //sha256
36+ test
37+ . stdout ( )
38+ . command ( [ 'hash' , '-t' , 'sha256' , 'ashish' ] )
39+ . it ( "cdt hash -t sha256 'ashish'" , ctx => {
40+ expect ( ctx . stdout ) . to . contain ( '05d08de271d2773a504b3a30f98df26cccda55689a8dc3514f55d3f247553d2b' )
41+ } )
42+
43+ //md5
44+ test
45+ . stdout ( )
46+ . command ( [ 'hash' , '--type' , 'md5' , 'ashish' ] )
47+ . it ( "cdt hash --type md5 'ashish'" , ctx => {
48+ expect ( ctx . stdout ) . to . contain ( '7b69ad8a8999d4ca7c42b8a729fb0ffd' )
49+ } )
50+
51+ //sha512
52+ test
53+ . stdout ( )
54+ . command ( [ 'hash' , '--type' , 'sha512' , 'ashish' ] )
55+ . it ( "cdt hash --type sha512 'ashish'" , ctx => {
56+ expect ( ctx . stdout ) . to . contain ( '2e076fcbd0e5dcb29d30da42a554de919864bbc29eaefe6d32c4f6bcb219d77ce5e48dada485dae92c918b10a03f42008c43ca721f06da6efa5fa9a223401907' )
57+ } )
58+
59+ //rmd160
60+ test
61+ . stdout ( )
62+ . command ( [ 'hash' , '--type' , 'rmd160' , 'ashish' ] )
63+ . it ( "cdt hash --type rmd160 'ashish'" , ctx => {
64+ expect ( ctx . stdout ) . to . contain ( 'a85a72b0a240abecdf27f127aa75fd8663d6d5be' )
1665 } )
1766} )
0 commit comments