Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
buvard
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PLN
buvard
Commits
87f866e5
Commit
87f866e5
authored
Nov 11, 2026
by
PLN (Algolia)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: sélection des modèles et champs anti-raisonnement du payload
parent
c4387bce
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
2 deletions
+44
-2
fix.test.mjs
test/fix.test.mjs
+44
-2
No files found.
test/fix.test.mjs
View file @
87f866e5
...
@@ -17,10 +17,17 @@ const CLI = fileURLToPath(new URL('../bin/buvard.js', import.meta.url));
...
@@ -17,10 +17,17 @@ const CLI = fileURLToPath(new URL('../bin/buvard.js', import.meta.url));
const SLOPPY = 'Soyons honnêtes : le montage cassait. Il est essentiel de noter que le débit tombait à 5 Go/s.';
const SLOPPY = 'Soyons honnêtes : le montage cassait. Il est essentiel de noter que le débit tombait à 5 Go/s.';
/** Un faux LM Studio : POST unique, réponse JSON, port éphémère sur 127.0.0.1. */
/** Un faux LM Studio : POST unique, réponse JSON, port éphémère sur 127.0.0.1.
function mockServer(handler) {
* GET /v1/models répond la liste `models` (un seul modèle par défaut : il
* passe quoi qu'il en soit — cf. la sélection dans lib/fix.mjs). */
function mockServer(handler, models) {
return new Promise((resolve) => {
return new Promise((resolve) => {
const server = http.createServer((req, res) => {
const server = http.createServer((req, res) => {
if (req.method === 'GET') {
res.setHeader('content-type', 'application/json');
res.end(JSON.stringify({ data: models ?? [{ id: 'local-model' }] }));
return;
}
let raw = '';
let raw = '';
req.on('data', (c) => (raw += c));
req.on('data', (c) => (raw += c));
req.on('end', () => handler(JSON.parse(raw), res));
req.on('end', () => handler(JSON.parse(raw), res));
...
@@ -197,3 +204,38 @@ test('the CLI --json reports the whole structured result', async () => {
...
@@ -197,3 +204,38 @@ test('the CLI --json reports the whole structured result', async () => {
assert.equal(parsed.fix.rounds[0].suggestions[0].status, 'appliquée');
assert.equal(parsed.fix.rounds[0].suggestions[0].status, 'appliquée');
assert.match(parsed.fix.diff, /^-/m);
assert.match(parsed.fix.diff, /^-/m);
});
});
test('model listing honored: the first non-reasoning id wins', async () => {
const { server, url } = await mockServer(
(body, res) => reply(res, jsonOf([{ excerpt: 'Soyons honnêtes : ', suggestion: '', rule: 'ouverture-vide', why: 'x' }])),
[{ id: 'deepseek-r1-32b' }, { id: 'qwen2.5-7b-instruct' }],
);
const r = await fixText(SLOPPY, { url, maxRounds: 1 });
server.close();
assert.equal(r.model, 'qwen2.5-7b-instruct');
});
test('an all-reasoning listing fails clean, pointing at BUVARD_FIX_MODEL', async () => {
const { server, url } = await mockServer(() => {}, [{ id: 'deepseek-r1' }, { id: 'qwq-32b' }]);
await assert.rejects(
() => fixText(SLOPPY, { url, maxRounds: 1 }),
(e) => {
assert.ok(e instanceof FixError);
assert.match(e.message, /BUVARD_FIX_MODEL/);
return true;
},
);
server.close();
});
test('the payload always carries the reasoning-off fields, explicit model included', async () => {
let payload = null;
const { server, url } = await mockServer((body, res) => {
payload = body;
reply(res, jsonOf([{ excerpt: 'Soyons honnêtes : ', suggestion: '', rule: 'ouverture-vide', why: 'x' }]));
});
await fixText(SLOPPY, { url, maxRounds: 1, model: 'deepseek-r1-32b' });
server.close();
assert.equal(payload.reasoning_effort, 'low');
assert.deepEqual(payload.chat_template_kwargs, { enable_thinking: false });
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment