ui优化
This commit is contained in:
1 parent
648b274c55
commit
18cb51670c
14 files changed
+420
-171
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const createStudioUrl = new URL("../components/create-studio.tsx", import.meta.url);
|
||||
|
||||
describe("create studio template interaction", () => {
|
||||
it("applies and clears templates without changing the selected creation mode", async () => {
|
||||
const source = await readFile(createStudioUrl, "utf8");
|
||||
const clearSelection = functionSource(source, "clearImageTemplateSelection", "applyTemplateToConsole");
|
||||
const applyTemplate = functionSource(source, "applyTemplateToConsole", "resetTemplateForm");
|
||||
|
||||
expect(clearSelection).not.toMatch(/\bsetMode\s*\(/);
|
||||
expect(applyTemplate).not.toMatch(/\bsetMode\s*\(/);
|
||||
expect(applyTemplate).toContain("[generateMode]: template.prompt");
|
||||
});
|
||||
});
|
||||
|
||||
function functionSource(source: string, name: string, nextName: string) {
|
||||
const start = source.indexOf(`function ${name}`);
|
||||
const end = source.indexOf(`function ${nextName}`, start + 1);
|
||||
expect(start, `${name} should exist`).toBeGreaterThanOrEqual(0);
|
||||
expect(end, `${nextName} should follow ${name}`).toBeGreaterThan(start);
|
||||
return source.slice(start, end);
|
||||
}
|
||||
@@ -21,35 +21,32 @@ describe("Go runtime settings compatibility fixture", () => {
|
||||
publicSecretValue: "blank",
|
||||
runtimeApplication: "mixed",
|
||||
providerRuntimeApplication: "immediate",
|
||||
providerPersistence: "postgres-with-environment-fallback"
|
||||
providerPersistence: "postgres-with-environment-fallback",
|
||||
settingsPersistence: "postgres-with-environment-fallback"
|
||||
});
|
||||
expect(fixture.allowedKeys).toContain("IMAGE_GENERATE_ENGINE");
|
||||
expect(fixture.secretKeys).toContain("ALI_OSS_ACCESS_KEY_SECRET");
|
||||
expect(fixture.allowedKeys).not.toContain("DATABASE_URL");
|
||||
expect(fixture.databaseBackedKeys).toEqual(expect.arrayContaining([
|
||||
"VOLCENGINE_ACCESS_KEY_ID",
|
||||
"EVOLINK_API_KEY",
|
||||
"SEEDANCE_API_KEY",
|
||||
"BAILIAN_API_KEY",
|
||||
"IMAGE_GENERATE_ENGINE",
|
||||
"VIDEO_GENERATE_ENGINE"
|
||||
]));
|
||||
expect([...fixture.databaseBackedKeys].sort()).toEqual([...fixture.allowedKeys].sort());
|
||||
});
|
||||
|
||||
it("requires a PostgreSQL table for mutable provider settings", async () => {
|
||||
it("requires a PostgreSQL table for all mutable settings", async () => {
|
||||
const migration = await readFile(runtimeSettingsMigrationUrl, "utf8");
|
||||
expect(migration).toContain("create table if not exists platform_runtime_settings");
|
||||
expect(migration).toContain("setting_key text primary key");
|
||||
expect(migration).toContain("setting_value text not null");
|
||||
});
|
||||
|
||||
it("refreshes database settings at both job-build and provider-call seams", async () => {
|
||||
it("loads database settings for startup services and refreshes provider calls", async () => {
|
||||
const [application, runtime, service] = await Promise.all([
|
||||
readFile(applicationUrl, "utf8"),
|
||||
readFile(runtimeUrl, "utf8"),
|
||||
readFile(settingsServiceUrl, "utf8")
|
||||
]);
|
||||
expect(application).toContain("databaseSettingsService(getenv, database.Store)");
|
||||
expect(application).toContain("databaseSettingsService(getenv, repository)");
|
||||
expect(application).toContain("runtimeSettingsGetenv(ctx, getenv, runtimeSettings)");
|
||||
expect(application).toContain("ParseAuthConfig(startupGetenv)");
|
||||
expect(application).toContain("configuredOSSBlobStore(startupGetenv)");
|
||||
expect(application).toContain("newRuntimeProviderResolver(getenv, runtimeSettings)");
|
||||
expect(application).toContain("runtimeProviderJobBuilder{");
|
||||
expect(runtime).toContain("runtimeSettingsGetenv(ctx, builder.fallback, builder.settings)");
|
||||
|
||||
Reference in new issue
Block a user