revert: no new tests were asked for with the slide-cap change
The existing coverage moves with the constant: the review test asserts against review.MAX_SLIDES + 1, and the browser suite already checks the slide count the form sends. Removed so the change is exactly the four lines.
This commit is contained in:
parent
36f2652648
commit
87c69ce151
2 changed files with 0 additions and 37 deletions
|
|
@ -246,21 +246,6 @@ test.describe('My Resources', () => {
|
||||||
await expect(page.locator('#btn-mr-generate')).toBeEnabled();
|
await expect(page.locator('#btn-mr-generate')).toBeEnabled();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('the slide count reaches the schema limit of 60 and is sent as typed', async ({ authedPage: _, page }) => {
|
|
||||||
// The three caps agree at 60 now — the form, both generation clamps and the
|
|
||||||
// review ceiling. Thirty was the form's old limit while the review stopped
|
|
||||||
// at twenty, so a deck in between was written and silently never reviewed.
|
|
||||||
const sent = await stub(page);
|
|
||||||
await openTab(page);
|
|
||||||
const count = page.locator('#mr-slide-count');
|
|
||||||
await expect(count).toHaveAttribute('max', '60');
|
|
||||||
await page.fill('#mr-topic', 'a long deck');
|
|
||||||
await count.fill('60');
|
|
||||||
await page.click('#btn-mr-generate');
|
|
||||||
await expect.poll(() => sent.length, { timeout: 15000 }).toBeGreaterThan(0);
|
|
||||||
expect(sent[0].body.slideCount).toBe('60', 'sent as typed, not clamped back');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('unticking the library is sent as false, not omitted', async ({ authedPage: _, page }) => {
|
test('unticking the library is sent as false, not omitted', async ({ authedPage: _, page }) => {
|
||||||
const sent = await stub(page);
|
const sent = await stub(page);
|
||||||
await openTab(page);
|
await openTab(page);
|
||||||
|
|
|
||||||
|
|
@ -137,28 +137,6 @@ test('nothing about the review can fail a generation', async () => {
|
||||||
assert.match(long.reason, /too long/);
|
assert.match(long.reason, /too long/);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('the three caps agree, so a deck that can be generated can also be reviewed and modified', async () => {
|
|
||||||
// 20 used to be the review ceiling while the form allowed 30: a 21-30 slide
|
|
||||||
// deck was generated, stored and then silently never reviewed, and a
|
|
||||||
// modification above 20 was shown only the first 20 pages while the prompt
|
|
||||||
// claimed one image per slide. All three numbers are the schema's own limit
|
|
||||||
// now, which is what stops a deck falling between them.
|
|
||||||
assert.equal(review.MAX_SLIDES, 60, 'the review ceiling');
|
|
||||||
|
|
||||||
const route = read('src/routes/myResources.js');
|
|
||||||
assert.equal((route.match(/clampInt\(body\.slideCount, 3, 60, 8\)/g) || []).length, 2, 'both generation paths');
|
|
||||||
assert.match(read('public/components/my-resources.html'), /id="mr-slide-count"[^>]*max="60"/, 'the form');
|
|
||||||
assert.match(read('src/utils/deckSchema.js'), /slice\(0, 60\)/, 'and what the schema will store');
|
|
||||||
|
|
||||||
// The gate really moved: 60 slides is no longer "too long", 61 still is.
|
|
||||||
const sixty = await review.review({ slides: new Array(60).fill({ type: 'bullets', heading: 'x', bullets: [{ text: 'y' }] }) },
|
|
||||||
{ model: 'some-model', gotenberg: 'http://127.0.0.1:1', mime: 'application/x', pptx: Buffer.from(''), extractJson: () => null });
|
|
||||||
assert.notEqual(sixty.reason, 'deck too long to review', '60 slides is reviewed, not skipped');
|
|
||||||
assert.equal(sixty.reviewed, false, 'the renderer failed on the test\u2019s bad url, which is the point: it got that far');
|
|
||||||
const sixtyOne = await review.review({ slides: new Array(61).fill({ type: 'bullets', heading: 'x' }) }, { model: 'some-model' });
|
|
||||||
assert.equal(sixtyOne.reason, 'deck too long to review');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('the reviewer is admin-chosen, off by default, and runs once per change', () => {
|
test('the reviewer is admin-chosen, off by default, and runs once per change', () => {
|
||||||
const route = read('src/routes/myResources.js');
|
const route = read('src/routes/myResources.js');
|
||||||
assert.match(route, /db\.getSetting\('my_resources\.review_model', ''\)/);
|
assert.match(route, /db\.getSetting\('my_resources\.review_model', ''\)/);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue