Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve stamp capacity listing #514

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/service/stamp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,10 @@ export function printStamp(
console.log(createKeyValue('Label', stamp.label))
}
console.log(createKeyValue('Usage', richStamp.usageText))
console.log(createKeyValue('Remaining Capacity', richStamp.remainingCapacity.toString()))
console.verbose(
console.log(
createKeyValue(
richStamp.immutableFlag ? 'Total Capacity (immutable)' : 'Total Capacity (mutable)',
richStamp.capacity.toString(),
richStamp.immutableFlag ? 'Capacity (immutable)' : 'Capacity (mutable)',
`${richStamp.remainingCapacity.toString()} remaining out of ${richStamp.capacity.toString()}`,
),
)

Expand Down
8 changes: 4 additions & 4 deletions test/command/stamp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ describeCommand(
({ consoleMessages, getLastMessage, getNthLastMessage, hasMessageContaining }) => {
it('should list stamps', async () => {
await invokeTestCli(['stamp', 'list'])
const pattern = [['Stamp ID'], ['Usage'], ['Remaining Capacity'], ['TTL']]
const pattern = [['Stamp ID'], ['Usage'], ['Capacity'], ['TTL']]
expect(consoleMessages).toMatchLinesInOrder(pattern)
})

it('should show a specific stamp', async () => {
await invokeTestCli(['stamp', 'show', Types.asString(process.env.STAMP)])
const pattern = [['Stamp ID', Types.asString(process.env.STAMP)], ['Usage'], ['Remaining Capacity'], ['TTL']]
const pattern = [['Stamp ID', Types.asString(process.env.STAMP)], ['Usage'], ['Capacity'], ['TTL']]
expect(consoleMessages).toMatchLinesInOrder(pattern)
})

Expand Down Expand Up @@ -57,7 +57,7 @@ describeCommand(

const id = command.postageBatchId
await invokeTestCli(['stamp', 'show', id, '--verbose'])
const pattern = [['Total Capacity (immutable)']]
const pattern = [['Capacity (immutable)']]
expect(consoleMessages).toMatchLinesInOrder(pattern)
await System.sleepMillis(11_000)
})
Expand All @@ -69,7 +69,7 @@ describeCommand(

it('should list with sorting and filter', async () => {
await invokeTestCli(['stamp', 'list', '--min-usage', '0', '--max-usage', '100', '--least-used', '--limit', '1'])
const pattern = [['Stamp ID'], ['Usage'], ['Remaining Capacity'], ['TTL']]
const pattern = [['Stamp ID'], ['Usage'], ['Capacity'], ['TTL']]
expect(consoleMessages).toMatchLinesInOrder(pattern)
})

Expand Down
Loading