PEP-140: tests that compare message texts read them without the marks
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
parent
35fa8d5a4f
commit
91e11a8ed4
@ -144,7 +144,7 @@ describe("master chat", () => {
|
||||
|
||||
const master = await core.ensureMasterChat(db, pm.id);
|
||||
const r = await runner.postToChat(db, pm, { chatId: master.id, threadKey: null, text: `/task ${ref.key}`, via: "web" });
|
||||
assert.match(r.reply!.text, new RegExp(`${ref.key}: Платежи[\\s\\S]*бэклог`));
|
||||
assert.match(stripAsIs(r.reply!.text), new RegExp(`${ref.key}: Платежи[\\s\\S]*бэклог`));
|
||||
const bad = await runner.postToChat(db, pm, { chatId: master.id, threadKey: null, text: "/deploy всё", via: "web" });
|
||||
assert.match(bad.reply!.text, /Не знаю такую команду[\s\S]*\/move/);
|
||||
// Bob's master chat is his own.
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
// PEP-57, spec delivery-pipeline: «Деплой по окружениям» и «Проверка здоровья и откат».
|
||||
// The template's .gitea/peppa-deploy.sh runs for real against mock-docker (docker CLI on
|
||||
// PATH) and a mock health endpoint; it reports to Peppa through handleGiteaHook.
|
||||
import { stripAsIs } from "@peppa/shared/i18n";
|
||||
import assert from "node:assert/strict";
|
||||
import { execFile, execFileSync } from "node:child_process";
|
||||
import { existsSync, mkdirSync, mkdtempSync, readFileSync, symlinkSync, writeFileSync } from "node:fs";
|
||||
@ -259,7 +260,7 @@ describe("Проверка здоровья и откат", () => {
|
||||
const msg = (await core.pendingQuestions(db, d.proj.id)).find((q) => q.text.includes(bad.slice(0, 7)) && q.text.includes("не прошло проверку"))!;
|
||||
assert.ok(msg, "the PM got a message");
|
||||
assert.match(msg.text, new RegExp(`возвращена прежняя версия ${good.slice(0, 7)}`));
|
||||
assert.match(msg.text, /Причина: проверка \/healthz/);
|
||||
assert.match(stripAsIs(msg.text), /Причина: проверка \/healthz/);
|
||||
assert.match(msg.text, new RegExp(`Подробности: ${gitea.url}/test/${d.proj.giteaRepo}/actions/runs/5`));
|
||||
assert.equal((await runner.currentReleases(db, d.proj.id)).prod?.sha, good);
|
||||
});
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
// PEP-112: the product works for a person, not in demo mode — the «чтобы заработало
|
||||
// по-настоящему» list, project secrets in deploys, the restart after a secret changes, and the
|
||||
// product agent that accepts each deploy (mock-intake, role "accept").
|
||||
import { stripAsIs } from "@peppa/shared/i18n";
|
||||
import assert from "node:assert/strict";
|
||||
import { createHmac } from "node:crypto";
|
||||
import { mkdirSync, mkdtempSync, readFileSync, writeFileSync, existsSync } from "node:fs";
|
||||
@ -76,7 +77,7 @@ describe("PEP-112: список «чтобы заработало по-наст
|
||||
const { added } = await core.declareNeeds(db, p.id, [{ title: "Ключ Claude API", why: "без него ответы — примеры", how: "console.anthropic.com → API keys", secret: "ANTHROPIC_API_KEY" }], { source: "agent", story: "FRT-3" });
|
||||
assert.equal(added.length, 1);
|
||||
assert.equal((await core.openNeeds(db, p.id)).length, 1);
|
||||
assert.match(await core.demoNote(db, p.id, p.key), /демо-режиме. Нужно от вас: Ключ Claude API/);
|
||||
assert.match(stripAsIs(await core.demoNote(db, p.id, p.key)), /демо-режиме. Нужно от вас: Ключ Claude API/);
|
||||
await core.setProjectSecret(db, pm.id, p.id, "ANTHROPIC_API_KEY", "sk-ant-mock-1");
|
||||
assert.equal((await core.openNeeds(db, p.id)).length, 0);
|
||||
assert.equal(await core.demoNote(db, p.id, p.key), "");
|
||||
@ -229,7 +230,7 @@ describe("PEP-112: смена секрета перезапускает прод
|
||||
const qs = await core.pendingQuestions(db, p.id);
|
||||
assert.equal(qs.length, 1);
|
||||
assert.match(qs[0]!.text, /версия для проверки перезапущена с новыми настройками/);
|
||||
assert.match(qs[0]!.text, /Ещё работает в демо-режиме, нужно: Ключ почты/);
|
||||
assert.match(stripAsIs(qs[0]!.text), /Ещё работает в демо-режиме, нужно: Ключ почты/);
|
||||
assert.ok(!qs.some((q) => q.options?.includes(runner.PROD_OPTION)));
|
||||
});
|
||||
});
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
// PEP-26, spec delivery-pipeline «Агент-ревьюер до ревью PM» — one test per scenario, against
|
||||
// mock Gitea (PR, diff, commit statuses), mock-claude runners calling the real peppa MCP server
|
||||
// and mock-reviewer as the reviewer agent.
|
||||
import { stripAsIs } from "@peppa/shared/i18n";
|
||||
import assert from "node:assert/strict";
|
||||
import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
@ -119,7 +120,7 @@ describe("Агент-ревьюер до ревью PM", () => {
|
||||
return qs.length ? qs : null;
|
||||
});
|
||||
assert.equal((await t.ref()).task.status, "review");
|
||||
assert.match(q!.text, /Ревьюер: ок — деление и ошибка на ноль сделаны, тесты есть/);
|
||||
assert.match(stripAsIs(q!.text), /Ревьюер: ок — деление и ошибка на ноль сделаны, тесты есть/);
|
||||
assert.ok(await runner.isReviewQuestion(db, q!), "«Принять» works on it");
|
||||
// Exactly one ready-for-review, whichever finished first (the agent's turn or the reviewer).
|
||||
await new Promise((r) => setTimeout(r, 1500));
|
||||
@ -127,7 +128,7 @@ describe("Агент-ревьюер до ревью PM", () => {
|
||||
assert.equal(calls().length, 1);
|
||||
const d = await core.getTaskDetails(db, await t.ref());
|
||||
assert.equal(d.review?.verdict, "ok");
|
||||
assert.equal(core.reviewLabel(d.review!), "Ревьюер: ок — деление и ошибка на ноль сделаны, тесты есть");
|
||||
assert.equal(stripAsIs(core.reviewLabel(d.review!)), "Ревьюер: ок — деление и ошибка на ноль сделаны, тесты есть");
|
||||
await stopAll(t);
|
||||
});
|
||||
|
||||
@ -207,7 +208,7 @@ describe("reviewer details", () => {
|
||||
await core.updateTask(db, await t.ref(), { status: "in_progress" });
|
||||
await core.finishReview(db, done.id, { verdict: "ok", summary: "ок", findings: [] });
|
||||
const again = await runner.requestReview(db, { ...(await t.ref()) });
|
||||
assert.deepEqual(again, { action: "review", note: "🔎 Ревьюер: ок — ок" });
|
||||
assert.deepEqual(again.action === "review" ? { ...again, note: stripAsIs(again.note ?? "") } : again, { action: "review", note: "🔎 Ревьюер: ок — ок" });
|
||||
});
|
||||
|
||||
test("no runner and findings: the agent is started with the findings; the watchdog runs queued reviews", async () => {
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
// PEP-120: the story page in «Продакт» mode — plain words, «шаг N из M», what is needed,
|
||||
// what comes next, «Принять» / «Поправить». Tests are named after the spec scenarios.
|
||||
import { stripAsIs } from "@peppa/shared/i18n";
|
||||
import assert from "node:assert/strict";
|
||||
import { after, describe, test } from "node:test";
|
||||
import type { StoryProductInput } from "@peppa/core";
|
||||
@ -75,7 +76,7 @@ describe("PEP-120: story page in «Продакт» mode", () => {
|
||||
assert.ok(v.now && v.next, JSON.stringify(s));
|
||||
assert.doesNotMatch(text, FORBIDDEN, JSON.stringify(s));
|
||||
}
|
||||
assert.match(view({ status: "backlog", agentWorking: false, waitsFor: ["Оплата картой"] }).now, /«Оплата картой»/);
|
||||
assert.match(stripAsIs(view({ status: "backlog", agentWorking: false, waitsFor: ["Оплата картой"] }).now), /«Оплата картой»/);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
// PEP-67: agent subscriptions (Claude Code / Codex / OpenCode), pools and the subscription a
|
||||
// runner starts on. Sign-in and trial runs go through the mock CLIs (mock-claude, mock-codex,
|
||||
// mock-opencode) with the real contracts: setup-token, device auth, --with-api-key, -p/exec/run.
|
||||
import { stripAsIs } from "@peppa/shared/i18n";
|
||||
import assert from "node:assert/strict";
|
||||
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
||||
import { join, resolve } from "node:path";
|
||||
@ -277,7 +278,7 @@ describe("PEP-76: владелец выбирает подписку проек
|
||||
assert.equal(await runner.chooseSharedSubscription(db, owner, p), "requested", "asking again changes nothing");
|
||||
const asks = (await core.pendingQuestions(db, platform.id)).filter((q) => q.text.includes("просит подписку Peppa FACTORY"));
|
||||
assert.equal(asks.length, 1, "one request, to the superadmin (platform project → Home and Telegram)");
|
||||
assert.match(asks[0]!.text, new RegExp(`${owner.login} просит подписку Peppa FACTORY для проекта «P76» \\(MPSUB\\)`));
|
||||
assert.match(stripAsIs(asks[0]!.text), new RegExp(`${owner.login} просит подписку Peppa FACTORY для проекта «P76» \\(MPSUB\\)`));
|
||||
assert.deepEqual(asks[0]!.options, [runner.SHARED_APPROVE, runner.SHARED_DENY]);
|
||||
assert.equal((await runner.sharedRequest(db, p.id))!.login, owner.login);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user