Skip to content

Commit 012d28a

Browse files
committed
test: add no-swap tests
1 parent 10e0966 commit 012d28a

File tree

7 files changed

+46
-8
lines changed

7 files changed

+46
-8
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ jobs:
4343
- name: Run bee-dev
4444
run: npx bee-dev --port 16337 &
4545

46+
- name: Run bee-dev
47+
run: npx bee-dev --port 16338 --no-swap &
48+
4649
- name: Start fdp-play environment
4750
run: fdp-play start --detach --fresh --bee-version ${{ matrix.bee-version }}
4851

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
},
6464
"dependencies": {
6565
"@ethereumjs/wallet": "^2.0.4",
66-
"@ethersphere/bee-js": "^9.8.1",
66+
"@ethersphere/bee-js": "^10.0.1",
6767
"cafe-utility": "^31.0.0",
6868
"chalk": "^2.4.2",
6969
"cli-progress": "^3.11.2",

src/command/addresses.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class Addresses extends RootCommand implements LeafCommand {
4343
this.console.log('')
4444
this.console.log(chalk.bold('Chequebook Address'))
4545
this.console.divider()
46-
this.console.log(chequebookAddress.chequebookAddress)
46+
this.console.log(chequebookAddress.chequebookAddress.toHex())
4747
})
4848

4949
this.console.quiet('Ethereum ' + this.nodeAddresses.ethereum)

src/command/pss/subscribe.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ export class Subscribe extends PssCommand implements LeafCommand {
3434
onError: (error: BeeError) => {
3535
this.console.error(error.message)
3636
},
37+
onClose: () => {
38+
this.console.log('Subscription closed')
39+
},
3740
})
3841
}
3942
}

src/command/status.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class Status extends RootCommand implements LeafCommand {
5959
this.console.all(createKeyValue('xDAI', nativeTokenBalance.toDecimalString()))
6060
} catch {
6161
this.console.all(chalk.yellow('Wallet balance not available'))
62-
this.console.all('This is normal if swap is disabled in the node configuration.')
62+
this.console.all('This is normal if chequebook is disabled in the node configuration.')
6363
}
6464
}
6565

@@ -72,7 +72,7 @@ export class Status extends RootCommand implements LeafCommand {
7272
this.console.all(createKeyValue('Total xBZZ', totalBalance.toDecimalString()))
7373
} catch {
7474
this.console.all(chalk.yellow('Chequebook balance not available'))
75-
this.console.all('This is normal if swap is disabled in the node configuration.')
75+
this.console.all('This is normal if chequebook is disabled in the node configuration.')
7676
}
7777
}
7878

test/misc/status-swap.spec.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { toMatchLinesInOrder } from '../custom-matcher'
2+
import { describeCommand, invokeTestCli } from '../utility'
3+
4+
expect.extend({
5+
toMatchLinesInOrder,
6+
})
7+
8+
describeCommand('Status command and swap', ({ consoleMessages }) => {
9+
it('should print wallet and chequebook balance', async () => {
10+
await invokeTestCli(['stamp', 'status', '--bee-api-url', 'http://localhost:16337'])
11+
expect(consoleMessages).toMatchLinesInOrder([
12+
['Wallet'],
13+
['xBZZ'],
14+
['xDAI'],
15+
['Chequebook'],
16+
['Available xBZZ'],
17+
['Total xBZZ'],
18+
])
19+
})
20+
21+
it('should handle missing wallet and chequebook balance', async () => {
22+
await invokeTestCli(['stamp', 'status', '--bee-api-url', 'http://localhost:16337'])
23+
expect(consoleMessages).toMatchLinesInOrder([
24+
['Wallet'],
25+
['Wallet balance not available'],
26+
['This is normal if chequebook is disabled in the node configuration.'],
27+
['Chequebook'],
28+
['Wallet balance not available'],
29+
['This is normal if chequebook is disabled in the node configuration.'],
30+
])
31+
})
32+
})

0 commit comments

Comments
 (0)