|
| 1 | +/* |
| 2 | + * Libration |
| 3 | + * Copyright (C) 2026 Ken McDonald |
| 4 | + * |
| 5 | + * This program is free software: you can redistribute it and/or modify |
| 6 | + * it under the terms of the GNU Affero General Public License as published |
| 7 | + * by the Free Software Foundation, version 3. |
| 8 | + * |
| 9 | + * This program is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 12 | + */ |
| 13 | + |
| 14 | +import { describe, expect, it } from "vitest"; |
| 15 | +import { getActiveAppConfig } from "./displayPresets"; |
| 16 | +import { |
| 17 | + appConfigToV2, |
| 18 | + defaultLibrationConfigV2, |
| 19 | + v2ToAppConfig, |
| 20 | +} from "./v2/librationConfig"; |
| 21 | +import { DEFAULT_APP_CONFIG, DEFAULT_DATA_CONFIG } from "./appConfig"; |
| 22 | +import { resolveStartupWorkingV2 } from "./v2/workingV2Persistence"; |
| 23 | + |
| 24 | +describe("default data mode", () => { |
| 25 | + it("defaults to static mode when no persisted config exists", () => { |
| 26 | + expect(DEFAULT_DATA_CONFIG.mode).toBe("static"); |
| 27 | + expect(DEFAULT_APP_CONFIG.data.mode).toBe("static"); |
| 28 | + expect(getActiveAppConfig().data.mode).toBe("static"); |
| 29 | + |
| 30 | + const working = resolveStartupWorkingV2(null, () => |
| 31 | + appConfigToV2(getActiveAppConfig()), |
| 32 | + ); |
| 33 | + expect(working.data.mode).toBe("static"); |
| 34 | + |
| 35 | + const v2 = appConfigToV2(DEFAULT_APP_CONFIG); |
| 36 | + expect(v2.data.mode).toBe("static"); |
| 37 | + expect(v2ToAppConfig(v2).data.mode).toBe("static"); |
| 38 | + expect(defaultLibrationConfigV2().data.mode).toBe("static"); |
| 39 | + }); |
| 40 | +}); |
0 commit comments