summaryrefslogtreecommitdiff
path: root/plugins/code-modernization/tests
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/code-modernization/tests')
-rw-r--r--plugins/code-modernization/tests/register.test.ts25
-rw-r--r--plugins/code-modernization/tests/stacks.test.ts9
-rw-r--r--plugins/code-modernization/tests/verification.test.ts5
3 files changed, 34 insertions, 5 deletions
diff --git a/plugins/code-modernization/tests/register.test.ts b/plugins/code-modernization/tests/register.test.ts
index 2eef3fa2..e1dbce63 100644
--- a/plugins/code-modernization/tests/register.test.ts
+++ b/plugins/code-modernization/tests/register.test.ts
@@ -162,6 +162,8 @@ describe('start and pane', () => {
expect(textOf(tree), 'no by-hand tag on a step the pane does itself').not.toContain('(by hand)')
expect(labels).toContain('sign the brief')
expect(labels, 'nothing to paste into the prompt').not.toContain('put in prompt')
+ expect(labels, 'the pane reads the disk by itself (after a write, at the end of a turn, and while idle): no manual refresh').not.toContain('refresh')
+ expect(labels).toEqual(['hide', 'sign the brief', 'review rules'])
await $.ui.press({ plugin: NAME, key: 'sign' })
expect(world.opened.at(-1)).toEqual({ id: 'modernize-sign', focus: true })
@@ -503,6 +505,27 @@ describe('review deck', () => {
expect(page).toContain('| R-99 | Wrong |')
})
+ test('a P0 rule sent to discussion, or marked wrong, is said in the pane: the build commands wait on it', async ($, on) => {
+ const file = (reviews: Record<string, unknown>) => JSON.stringify({ system: 'billing', version: 1, reviews })
+ const world = worldOf(on, { ...FULL, 'analysis/billing/RULE_REVIEWS.json': file({ 'P0-001': { verdict: 'discuss', at: '2026-09-16', note: 'ask Finance' } }) })
+
+ mock.clock(on)
+ await $.session.start(SESSION)
+
+ const first = textOf(await $.ui.render(PANE))
+
+ expect(first).toContain('1 high-priority rule under discussion: the build waits')
+ expect(first).not.toContain('marked wrong')
+
+ world.put('analysis/billing/RULE_REVIEWS.json', file({ 'P0-001': { verdict: 'discuss', at: '2026-09-16' }, 'P0-002': { verdict: 'wrong', at: '2026-09-16' } }))
+ await $.command.run(command('modernize-panel', 'json'))
+
+ const second = textOf(await $.ui.render(PANE))
+
+ expect(second).toContain('1 high-priority rule under discussion')
+ expect(second).toContain('1 rule marked wrong by a reviewer: no test is built on it')
+ })
+
test('close hands the band back', async ($, on) => {
worldOf(on, FULL)
mock.clock(on)
@@ -574,7 +597,7 @@ describe('prompt context', () => {
const first = await $.prompt.submit({ text: 'hello', wait: false, origin: { kind: 'composer' } })
const second = await $.prompt.submit({ text: 'again', wait: false, origin: { kind: 'composer' } })
- expect((first.context ?? []).join(' ')).toContain('billing: analysis 5/5 steps done · brief approved · 1 of 3 modules reviewed')
+ expect((first.context ?? []).join(' ')).toContain('billing: analysis 5/5 · brief approved · 1/3 modules reviewed')
expect(second.context, 'unchanged: not attached again').toBe(undefined)
})
})
diff --git a/plugins/code-modernization/tests/stacks.test.ts b/plugins/code-modernization/tests/stacks.test.ts
index b71e2503..873f23a0 100644
--- a/plugins/code-modernization/tests/stacks.test.ts
+++ b/plugins/code-modernization/tests/stacks.test.ts
@@ -69,9 +69,9 @@ describe('uplift, whatever the stack', () => {
// The uplift command takes the two versions from what the person said at the start, and asks when it has none: no placeholder.
expect(snapshot.next?.isByHand).toBe(false)
expect(snapshot.next?.text).toBe(`${PREFIX}uplift shop`)
- expect(snapshot.next?.reason).toContain('compares every result with the baseline')
+ expect(snapshot.next?.reason).toContain('each compared with the baseline')
- expect(oneLineOf(snapshot)).toContain('shop: uplift 5/7 steps done')
+ expect(oneLineOf(snapshot)).toContain('shop: uplift 5/7 · ')
expect(snapshot.percent).not.toBe(null)
})
@@ -391,6 +391,11 @@ describe('the pane in another stack', () => {
expect(text).toContain('Java 100%')
expect(text).toContain('matches baseline')
expect(text).toContain('worse than baseline')
+ // Two rows of modules fit: problems first, then what is finished; what is only edited so far waits behind them.
+ expect(text).toContain('shop-web worse than baseline')
+ expect(text).toContain('shop-core matches baseline')
+ expect(text).not.toContain('shop-batch changed')
+ expect(text).toContain('… 1 more')
expect(text).toContain('/code-modernization:modernize-uplift shop')
expect(text).not.toContain('<from>')
expect(text).not.toContain('(by hand)')
diff --git a/plugins/code-modernization/tests/verification.test.ts b/plugins/code-modernization/tests/verification.test.ts
index 5578de8f..e18540ff 100644
--- a/plugins/code-modernization/tests/verification.test.ts
+++ b/plugins/code-modernization/tests/verification.test.ts
@@ -175,7 +175,7 @@ describe('what the pane makes of the proof', () => {
const none = await withPack([])
expect(none.next).toMatchObject({ text: `${PREFIX}verify billing INTCALC`, isByHand: false })
- expect(none.next?.reason).toContain('nothing has checked yet')
+ expect(none.next?.reason).toBe('INTCALC is built but not yet checked against the old code')
const changed = await withPack([entry('INTCALC', 'PROVEN')], { [NOTES]: CHECKED + HOUR })
@@ -193,12 +193,13 @@ describe('what the pane makes of the proof', () => {
const partly = await withPack([entry('INTCALC', 'PARTLY PROVEN', ['Fresh inputs: only 3.'])])
expect(partly.next?.text, 'Phase 1 is built and checked: on to the review of the plan').toBe(`${PREFIX}status billing`)
- expect(partly.attention.some(line => line.includes('PROVEN'))).toBe(false)
+ expect(partly.attention, 'a person decides on what could not be completed: the reason is one line under Attention').toContain('INTCALC: PARTLY PROVEN: Fresh inputs: only 3.')
const proven = await withPack([entry('INTCALC', 'PROVEN')])
expect(proven.next?.text).toBe(`${PREFIX}status billing`)
expect(proven.next?.reason).toContain('built and checked')
+ expect(proven.attention.some(line => line.includes('PROVEN')), 'nothing to say of a proven module').toBe(false)
})
test('modules are taken in the order the phase names them: one built and unchecked comes before the next one is started', async () => {