feat(portal): deliver ordinary national credit fraction and education continuity
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-11-10 12:47:57 +02:00
parent ff726e577f
commit c359364de3
14 changed files with 749 additions and 126 deletions
+63
View File
@@ -3,6 +3,69 @@ import assert from 'node:assert/strict';
import { harness, props, text } from './helpers/education-review.mjs';
const form = 'education-review';
function historyPage(page = 1) {
return {
data: [], total: 24, current_page: page, last_page: 2,
prev_page_url: page === 2 ? '/management/education/demands/one?scope=review&history_page=1' : null,
next_page_url: page === 1 ? '/management/education/demands/one?scope=review&history_page=2' : null,
};
}
test('history paging keeps the prepared review and does not ask to discard it', () => {
const h = harness(props({ history: historyPage() }));
h.change(form, reason, 'SYNTHETIC reasoning still being prepared.');
const next = h.all().find(node => node.type === 'a' && text(node) === 'Seguinte');
assert.equal(next.props.preserveState, true);
assert.equal(next.props.preserveScroll, true);
assert.match(next.props.href, /scope=review&history_page=2$/);
assert.equal(h.leave(next.props.preserveState), false);
assert.equal(h.confirmCalls, 0);
h.render({ ...h.props, history: historyPage(2) });
assert.equal(h.field(form, reason).props.value, 'SYNTHETIC reasoning still being prepared.');
const previous = h.all().find(node => node.type === 'a' && text(node) === 'Anterior');
assert.equal(previous.props.preserveState, true);
assert.equal(previous.props.preserveScroll, true);
assert.equal(h.sent.length, 0);
assert.equal(h.leave(), true); // Leaving the declaration still protects unsaved work.
});
test('history paging keeps an uncertain attempt recoverable under the same command key', () => {
const h = harness(props({ history: historyPage() }));
const request = prepared(h);
h.fail(request);
h.render({ ...h.props, history: historyPage(2) });
const retry = h.submit(form);
assert.deepEqual(retry.data, request.data);
assert.equal(h.sent.length, 2); // One explicit retry; paging itself sends no decision.
});
test('history paging cannot silently approve a newer declaration version', () => {
const h = harness(props({ history: historyPage() }));
h.change(form, reason, 'SYNTHETIC review prepared against version one.');
h.render({
...h.props, history: historyPage(2),
declaration: { ...h.props.declaration, version_no: 2, quantity: 31 },
});
h.submit(form);
assert.equal(h.sent.length, 0);
assert.equal(h.field(form, reason).props.value, 'SYNTHETIC review prepared against version one.');
assert.match(text(h.tree), /A declaração mudou/);
h.click('Confirmar a leitura desta versão');
const request = h.submit(form);
assert.equal(request.data.version_no, 2);
});
test('history paging with a different actor remounts instead of disclosing the prepared reason', () => {
const h = harness(props({ history: historyPage() }));
h.change(form, reason, 'SYNTHETIC private reasoning of the previous actor.');
h.render({
...h.props, actorId: 3, history: historyPage(2),
declaration: { ...h.props.declaration, review_context: { actor_id: 3, commands: [] } },
});
assert.equal(h.field(form, reason).props.value, '');
assert.equal(h.sent.length, 0);
});
test('the private detail renders preserved reasons, unavailable entries and contextual history pagination', () => {
const h = harness(
props({