list-secrets.test.js 718 B

12345678910111213141516171819202122
  1. import { test, before, after } from 'node:test'
  2. import assert from 'node:assert/strict'
  3. import { run } from '../../src/commands/list-secrets.js'
  4. import { fixtureCtx } from './_helper.js'
  5. let ctx, cleanup
  6. before(async () => {
  7. ;({ ctx, cleanup } = await fixtureCtx())
  8. })
  9. after(async () => {
  10. await cleanup()
  11. })
  12. test('list-secrets 列出未揭晓信息差,含蓄积章数', async () => {
  13. const r = await run([], { 'reader-knows': 'false' }, ctx)
  14. assert.equal(r.ok, true)
  15. const rows = JSON.parse(r.output)
  16. const one = rows.find((s) => s.id === '信息差-001')
  17. assert.ok(one, `应含 信息差-001,实际:${r.output}`)
  18. // 当前最大章 2 − 登记章 1 = 1
  19. assert.equal(one.蓄积章数, 1)
  20. })