@@ -123,32 +123,50 @@ describeCommand(
123123 } )
124124 } )
125125
126- describe ( 'list ' , ( ) => {
127- it ( 'should list all grantees in the list' , async ( ) => {
126+ describe ( 'show ' , ( ) => {
127+ it ( 'should show all grantees in the list' , async ( ) => {
128128 const granteePubKey = await getPublicAddress ( 'http://localhost:21633' )
129129 await invokeTestCli ( [ 'access' , 'init' , ...getStampOption ( ) , '-n' , 'test-access' ] )
130130 await System . sleepMillis ( 1000 )
131131 await invokeTestCli ( [ 'access' , 'grant' , '--list-name' , 'test-access' , '--grantee' , granteePubKey ] )
132132 await System . sleepMillis ( 1000 )
133- await invokeTestCli ( [ 'access' , 'list ' , '--list-name' , 'test-access' ] )
133+ await invokeTestCli ( [ 'access' , 'show ' , '--list-name' , 'test-access' ] )
134134 expect ( getNthLastMessage ( 2 ) ) . toContain ( `Grantees of list 'test-access':` )
135135 expect ( getLastMessage ( ) ) . toContain ( granteePubKey )
136136
137137 await invokeTestCli ( [ 'access' , 'revoke' , '--list-name' , 'test-access' , '--grantee' , granteePubKey ] )
138138 await System . sleepMillis ( 1000 )
139- await invokeTestCli ( [ 'access' , 'list ' , '--list-name' , 'test-access' ] )
139+ await invokeTestCli ( [ 'access' , 'show ' , '--list-name' , 'test-access' ] )
140140 expect ( getLastMessage ( ) ) . toContain ( "Grantee list 'test-access' has no grantees." )
141141 } )
142142
143143 describe ( 'when grantee list does not exist' , ( ) => {
144144 it ( 'should show error message' , async ( ) => {
145- await invokeTestCli ( [ 'access' , 'list ' , '-n' , 'nonexistent-list' ] )
145+ await invokeTestCli ( [ 'access' , 'show ' , '-n' , 'nonexistent-list' ] )
146146 expect ( consoleMessages [ 0 ] ) . toContain ( "Grantee list with name 'nonexistent-list' does not exist!" )
147147 expect ( consoleMessages [ 1 ] ) . toContain ( 'process.exit() was called with code 1' )
148148 } )
149149 } )
150150 } )
151151
152+ describe ( 'list' , ( ) => {
153+ it ( 'should show all grantee list names' , async ( ) => {
154+ await invokeTestCli ( [ 'access' , 'init' , ...getStampOption ( ) , '-n' , 'test-access' ] )
155+ await invokeTestCli ( [ 'access' , 'init' , ...getStampOption ( ) , '-n' , 'test-access-2' ] )
156+ await System . sleepMillis ( 1000 )
157+ await invokeTestCli ( [ 'access' , 'list' ] )
158+ expect ( getNthLastMessage ( 3 ) ) . toContain ( 'test-access' )
159+ expect ( getNthLastMessage ( 2 ) ) . toContain ( 'test-access-2' )
160+ } )
161+
162+ describe ( 'when grantee list does not exist' , ( ) => {
163+ it ( 'should show error message' , async ( ) => {
164+ await invokeTestCli ( [ 'access' , 'list' ] )
165+ expect ( consoleMessages [ 0 ] ) . toContain ( 'No grantee lists found.' )
166+ } )
167+ } )
168+ } )
169+
152170 describe ( 'history' , ( ) => {
153171 it ( 'should show the history of operations on a grantee list' , async ( ) => {
154172 const granteePubKey = await getPublicAddress ( 'http://localhost:21633' )
0 commit comments