Skip to content

Commit

Permalink
feat: show stamp mutability (#465)
Browse files Browse the repository at this point in the history
* feat: show stamp mutability

* test(fix): adjust pattern
  • Loading branch information
Cafe137 committed Aug 14, 2023
1 parent c8b1648 commit 824c14e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/service/stamp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ export function printStamp(
console.log(createKeyValue('Label', stamp.label))
}
console.log(createKeyValue('Usage', richStamp.usageText))
console.log(createKeyValue('Remaining Capacity', richStamp.remainingCapacity.toString()))
console.log(
createKeyValue(
richStamp.immutableFlag ? 'Remaining Capacity (immutable)' : 'Remaining Capacity (mutable)',
richStamp.remainingCapacity.toString(),
),
)
console.verbose(createKeyValue('Total Capacity', richStamp.capacity.toString()))

if (settings?.showTtl) {
Expand All @@ -94,7 +99,6 @@ export function printStamp(
console.verbose(createKeyValue('Usable', stamp.usable))
console.verbose(createKeyValue('Utilization', stamp.utilization))
console.verbose(createKeyValue('Block Number', stamp.blockNumber))
console.verbose(createKeyValue('Immutable Flag', stamp.immutableFlag))
console.quiet(settings?.printUsageInQuiet ? `${batchId} ${richStamp.usageText}` : batchId)
}

Expand Down
4 changes: 2 additions & 2 deletions test/command/stamp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ describeCommand(

const id = command.postageBatchId
await invokeTestCli(['stamp', 'show', id, '--verbose'])
expect(getLastMessage()).toContain('Immutable Flag')
expect(getLastMessage()).toContain('true')
const pattern = [['Remaining Capacity (immutable)']]
expect(consoleMessages).toMatchLinesInOrder(pattern)
await sleep(11_000)
})

Expand Down

0 comments on commit 824c14e

Please sign in to comment.