fix: 收敛模板编辑发布契约并还原餐饮页面视觉
This commit is contained in:
1 parent
20bcb43534
commit
f4061a24bd
102 files changed
+4510
-870
No files matched your search
@@ -1,3 +1,4 @@
|
||||
const assert = require("node:assert/strict");
|
||||
const { randomBytes } = require("node:crypto");
|
||||
const { spawnSync } = require("node:child_process");
|
||||
const { PrismaClient } = require("@prisma/client");
|
||||
@@ -10,6 +11,7 @@ const testUrl = new URL(databaseUrl);
|
||||
testUrl.searchParams.set("schema", schema);
|
||||
const testEnvironment = { ...process.env, DATABASE_URL: testUrl.toString(), NODE_ENV: "test" };
|
||||
const administrator = new PrismaClient();
|
||||
const fixtureDatabase = new PrismaClient({ datasourceUrl: testUrl.toString() });
|
||||
|
||||
function run(command, args) {
|
||||
const result = spawnSync(command, args, { stdio: "inherit", env: testEnvironment });
|
||||
@@ -25,9 +27,30 @@ async function main() {
|
||||
created = true;
|
||||
if (run("pnpm", ["exec", "prisma", "migrate", "deploy"]) !== 0) return status;
|
||||
if (run("pnpm", ["db:seed"]) !== 0) return status;
|
||||
const initialTrustCount = await fixtureDatabase.trustContent.count();
|
||||
const initialFormCount = await fixtureDatabase.inquiryForm.count();
|
||||
const initialReleases = await fixtureDatabase.brandRelease.findMany({ orderBy: { id: "asc" } });
|
||||
if (run("pnpm", ["db:seed"]) !== 0) return status;
|
||||
assert.equal(
|
||||
await fixtureDatabase.trustContent.count(),
|
||||
initialTrustCount,
|
||||
"Repeated seed must not duplicate trust content",
|
||||
);
|
||||
assert.equal(
|
||||
await fixtureDatabase.inquiryForm.count(),
|
||||
initialFormCount,
|
||||
"Repeated seed must not duplicate forms",
|
||||
);
|
||||
assert.deepEqual(
|
||||
await fixtureDatabase.brandRelease.findMany({ orderBy: { id: "asc" } }),
|
||||
initialReleases,
|
||||
"Repeated seed must preserve release history and snapshots",
|
||||
);
|
||||
console.log("Seed idempotency verified: content, forms and release history preserved");
|
||||
status = run(process.execPath, ["--test", "test/http.integration.test.js"]);
|
||||
return status;
|
||||
} finally {
|
||||
await fixtureDatabase.$disconnect();
|
||||
if (created) await administrator.$executeRawUnsafe(`DROP SCHEMA "${schema}" CASCADE`);
|
||||
await administrator.$disconnect();
|
||||
process.exitCode = status;
|
||||
|
||||
Reference in new issue
Block a user