1- import { Server } from 'http'
2- import { createChequeMockHttpServer } from '../http-mock/cheque-mock'
31import { describeCommand , invokeTestCli } from '../utility'
42
53async function runCommandAndExpectError (
@@ -15,39 +13,27 @@ async function runCommandAndExpectError(
1513describeCommand (
1614 'Test Cheque command' ,
1715 ( { consoleMessages, getNthLastMessage, getLastMessage } ) => {
18- let server : Server
19-
20- beforeAll ( ( ) => {
21- if ( ! server ) {
22- server = createChequeMockHttpServer ( 1377 )
23- }
24- } )
25-
26- afterAll ( ( ) => {
27- server . close ( )
28- } )
29-
3016 it ( 'should print cheques' , async ( ) => {
31- process . env . BEE_API_URL = 'http://localhost:1377 '
17+ process . env . BEE_API_URL = 'http://localhost:16337 '
3218 await invokeTestCli ( [ 'cheque' , 'list' ] )
3319 expect ( getLastMessage ( ) ) . toContain ( 'Cheque Value:' )
3420 expect ( getLastMessage ( ) ) . toContain ( '0.0008944000000000 xBZZ' )
3521 } )
3622
3723 it ( 'should not print cheques when --minimum is higher' , async ( ) => {
38- process . env . BEE_API_URL = 'http://localhost:1377 '
24+ process . env . BEE_API_URL = 'http://localhost:16337 '
3925 await invokeTestCli ( [ 'cheque' , 'list' , '--minimum' , '10000000000000000000' ] )
4026 expect ( getLastMessage ( ) ) . toContain ( 'No uncashed cheques found' )
4127 } )
4228
4329 it ( 'should print cheques when --minimum is lower' , async ( ) => {
44- process . env . BEE_API_URL = 'http://localhost:1377 '
30+ process . env . BEE_API_URL = 'http://localhost:16337 '
4531 await invokeTestCli ( [ 'cheque' , 'list' , '--minimum' , '1000' ] )
4632 expect ( getLastMessage ( ) ) . toContain ( 'Cheque Value' )
4733 } )
4834
4935 it ( 'should cashout all cheques' , async ( ) => {
50- process . env . BEE_API_URL = 'http://localhost:1377 '
36+ process . env . BEE_API_URL = 'http://localhost:16337 '
5137 await invokeTestCli ( [ 'cheque' , 'cashout' , '--all' ] )
5238 expect ( getNthLastMessage ( 3 ) ) . toContain ( 'Peer Address:' )
5339 expect ( getNthLastMessage ( 3 ) ) . toContain ( '1105536d0f270ecaa9e6e4347e687d1a1afbde7b534354dfd7050d66b3c0faad' )
@@ -58,20 +44,20 @@ describeCommand(
5844 } )
5945
6046 it ( 'should allow specifying gas price and limit for cashout' , async ( ) => {
61- process . env . BEE_API_URL = 'http://localhost:1377 '
47+ process . env . BEE_API_URL = 'http://localhost:16337 '
6248 await invokeTestCli ( [ 'cheque' , 'cashout' , '--all' , '--gas-price' , '100' , '--gas-limit' , '100' ] )
6349 expect ( getLastMessage ( ) ) . toContain ( 'Tx:' )
6450 expect ( getLastMessage ( ) ) . toContain ( '11df9811dc8caaa1ff4389503f2493a8c46b30c0a0b5f8aa54adbb965374c0ae' )
6551 } )
6652
6753 it ( 'should not cashout any cheques when --minimum is higher' , async ( ) => {
68- process . env . BEE_API_URL = 'http://localhost:1377 '
54+ process . env . BEE_API_URL = 'http://localhost:16337 '
6955 await invokeTestCli ( [ 'cheque' , 'cashout' , '--all' , '--minimum' , '10000000000000000000' ] )
7056 expect ( getLastMessage ( ) ) . toContain ( 'Found 0 cheques' )
7157 } )
7258
7359 it ( 'should cashout one specific cheque' , async ( ) => {
74- process . env . BEE_API_URL = 'http://localhost:1377 '
60+ process . env . BEE_API_URL = 'http://localhost:16337 '
7561 await invokeTestCli ( [
7662 'cheque' ,
7763 'cashout' ,
0 commit comments