feat: establish NekoNest Cloud control and relay
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { DatabaseSync } from "node:sqlite";
|
||||
import test from "node:test";
|
||||
import { BETA_ACCESS_REQUESTS_SQL } from "../db/beta-operations.ts";
|
||||
|
||||
test("uses the generated request-time index for the rolling beta application funnel", async () => {
|
||||
const [base, hostClaims, requests, timeIndex, bootstrap, metricsDoc] = await Promise.all([
|
||||
readFile(new URL("../drizzle/0000_condemned_legion.sql", import.meta.url), "utf8"),
|
||||
readFile(new URL("../drizzle/0001_mushy_vance_astro.sql", import.meta.url), "utf8"),
|
||||
readFile(new URL("../drizzle/0010_windy_toxin.sql", import.meta.url), "utf8"),
|
||||
readFile(new URL("../drizzle/0011_next_thunderball.sql", import.meta.url), "utf8"),
|
||||
readFile(new URL("../db/bootstrap.ts", import.meta.url), "utf8"),
|
||||
readFile(new URL("../docs/beta-operations.md", import.meta.url), "utf8"),
|
||||
]);
|
||||
const db = new DatabaseSync(":memory:");
|
||||
db.exec(base.replaceAll("--> statement-breakpoint", ""));
|
||||
db.exec(hostClaims.replaceAll("--> statement-breakpoint", ""));
|
||||
db.exec(requests.replaceAll("--> statement-breakpoint", ""));
|
||||
db.exec(timeIndex.replaceAll("--> statement-breakpoint", ""));
|
||||
const plan = db.prepare(`EXPLAIN QUERY PLAN ${BETA_ACCESS_REQUESTS_SQL}`).all("2026-07-13T00:00:00.000Z");
|
||||
assert.match(plan.map((row) => row.detail).join("\n"), /idx_beta_access_requests_requested_time/);
|
||||
assert.match(timeIndex, /CREATE INDEX `idx_beta_access_requests_requested_time`/);
|
||||
assert.match(bootstrap, /0011_next_thunderball/);
|
||||
assert.doesNotMatch(BETA_ACCESS_REQUESTS_SQL, /use_case/);
|
||||
assert.match(metricsDoc, /不读取 `use_case` 正文做分析/);
|
||||
db.close();
|
||||
});
|
||||
Reference in New Issue
Block a user