mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-19 12:10:37 +09:00
Fix manual company switch route sync
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
4a368f54d5
commit
2b9de934e3
4 changed files with 63 additions and 3 deletions
34
ui/src/lib/company-selection.test.ts
Normal file
34
ui/src/lib/company-selection.test.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import { shouldSyncCompanySelectionFromRoute } from "./company-selection";
|
||||
|
||||
describe("shouldSyncCompanySelectionFromRoute", () => {
|
||||
it("does not resync when selection already matches the route", () => {
|
||||
expect(
|
||||
shouldSyncCompanySelectionFromRoute({
|
||||
selectionSource: "route_sync",
|
||||
selectedCompanyId: "pap",
|
||||
routeCompanyId: "pap",
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("defers route sync while a manual company switch is in flight", () => {
|
||||
expect(
|
||||
shouldSyncCompanySelectionFromRoute({
|
||||
selectionSource: "manual",
|
||||
selectedCompanyId: "pap",
|
||||
routeCompanyId: "ret",
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("syncs back to the route company for non-manual mismatches", () => {
|
||||
expect(
|
||||
shouldSyncCompanySelectionFromRoute({
|
||||
selectionSource: "route_sync",
|
||||
selectedCompanyId: "pap",
|
||||
routeCompanyId: "ret",
|
||||
}),
|
||||
).toBe(true);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue