e2a4790f6c
Clicking the already-active WAR/PEACE button still appended a \`setDiplomaticStance\` whose \`relation\` matched the row's current value. The engine would accept the duplicate harmlessly, but the order tab inflates with rows that say nothing and every auto-sync re-ships the redundant payload. Compare against the overlayed stance (so a queued-but-not-applied change suppresses a re-click that matches the *intended* state, not just the server snapshot) and short-circuit when they agree. Mirrors the vote picker, which already had the same guard. vitest.config.ts: \`mergeConfig\` refuses callback-form base configs, so resolve \`vite.config.ts\`'s callback with the test context first and merge the plain object. Surfaced after the \`loadEnv\` migration switched the root config to the callback form. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
25 lines
846 B
TypeScript
25 lines
846 B
TypeScript
import { defineConfig, mergeConfig } from "vitest/config";
|
|
import viteConfig from "./vite.config";
|
|
|
|
// `vite.config.ts` exports a `defineConfig(({ mode }) => …)` callback
|
|
// so the dev server can load `.env*` files through Vite's `loadEnv`.
|
|
// `mergeConfig` does not accept callback-form configs, so resolve the
|
|
// callback here with the same context Vitest would supply, then hand
|
|
// the plain object to the merge.
|
|
export default defineConfig(async (ctx) => {
|
|
const resolved =
|
|
typeof viteConfig === "function" ? await viteConfig(ctx) : viteConfig;
|
|
return mergeConfig(resolved, {
|
|
resolve: {
|
|
// Force the browser entry of Svelte so `mount` is available in jsdom.
|
|
conditions: ["browser"],
|
|
},
|
|
test: {
|
|
environment: "jsdom",
|
|
include: ["tests/**/*.test.ts"],
|
|
globals: true,
|
|
setupFiles: ["./tests/setup.ts"],
|
|
},
|
|
});
|
|
});
|