Video settings:
- NVIDIA frame generation gains x6 (the multiplier was already in the list
but offered by no vendor) and Dynamic Multi Frame Generation (DLSS 4.5).
- "Custom…" for every vendor reveals a text field (`frameGenCustom`); the
description prints what was typed, like a custom graphics preset, and
nothing for an empty box.
- A "DLSS 5 Neural Rendering" switch (`dlssNeuralRendering`), shown for
NVIDIA only and printed after the DLSS mode:
"Ultra - NVIDIA DLSS Quality + NVIDIA DLSS 5 Neural Rendering + NVIDIA
Dynamic Multi Frame Generation". Another vendor turns it off
(`coerceDlssNeuralRendering`: the vendor switch, applied profiles and
templates, backup import).
- Editor store v21 -> v22 back-fills both fields.
- composeGraphicsPart's vendor half moves into small helpers.
My Rig: "Custom" is the LUT field's first suggestion (typing it works too,
any case). The rig block then prints just "LUT applied" in the output
language ("Có áp dụng LUT") instead of "LUT: Custom" — a field's
`customNoteKey`. No migration: the rig is a string map.
i18n: the new editor and description keys in all 8 locales and
_schema.json; brand names stay English. tests/engine/graphics-vendor.test.ts
also holds every vendor's options to their labels in the schema.
Docs: FEATURES (upscaler / frame-gen table, LUT Custom), TECH-SPEC (input
fields, store v22, rig block), CLAUDE.md (how to add an option).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
543 lines
20 KiB
TypeScript
543 lines
20 KiB
TypeScript
import { describe, it, expect } from "vitest";
|
||
import { migrateEditorState } from "@store/editor-store";
|
||
|
||
/**
|
||
* Regression tests for the editor-store v9 → v10 migration introduced
|
||
* in v0.12. The migration is purely additive: existing fields
|
||
* (`playthroughStatus`, `difficulty`, `contentWarnings`, …) must
|
||
* round-trip unchanged, while the new Playthrough Notes structured
|
||
* fields (`endingsShown`, `languagePatch`, `gameVersion`, …) and the
|
||
* `techNotes` checklist must back-fill to safe defaults.
|
||
*/
|
||
|
||
function makeV9Persisted(overrides: Record<string, unknown> = {}): Record<string, unknown> {
|
||
return {
|
||
videoType: "full",
|
||
language: "en",
|
||
genres: ["action"],
|
||
gameName: "Elden Ring",
|
||
channelName: "TestChannel",
|
||
platform: "steam",
|
||
partNumber: "",
|
||
bossName: "",
|
||
dlcName: "",
|
||
challengeName: "",
|
||
modName: "",
|
||
modList: "",
|
||
liveUrl: "",
|
||
scheduledTime: "",
|
||
gachaQuestType: "main_story",
|
||
chapterName: "",
|
||
questName: "",
|
||
resolution: "1080p",
|
||
fps: "60",
|
||
graphicsPreset: "medium",
|
||
graphicsPresetCustom: "",
|
||
skipGraphicsSettings: false,
|
||
rayTracingModes: [],
|
||
frameGenVendor: "none",
|
||
frameGenMultiplier: "none",
|
||
upscaleQuality: "none",
|
||
artStyle: "none",
|
||
versionInfo: "",
|
||
timestamps: "",
|
||
playlistLink: "",
|
||
contactEmail: "",
|
||
musicAttribution: "",
|
||
sponsorName: "",
|
||
sponsorPlatform: "",
|
||
pubDevName: "",
|
||
thirdPartyAdText: "",
|
||
thumbnailText: "",
|
||
pinnedComment: "",
|
||
spoilerWarning: false,
|
||
matureWarning: false,
|
||
playthroughStatus: "none",
|
||
difficulty: "none",
|
||
difficultyCustomLabel: "",
|
||
contentWarnings: [],
|
||
storeLinks: {},
|
||
storeLinkTypes: {},
|
||
social: {},
|
||
rig: {},
|
||
vnBankName: "",
|
||
vnBankAccount: "",
|
||
vnBankHolder: "",
|
||
vnMomo: "",
|
||
vnZalopay: "",
|
||
...overrides,
|
||
};
|
||
}
|
||
|
||
describe("migrateEditorState — v9 → v10 (v0.12)", () => {
|
||
it("back-fills new Playthrough Notes fields with safe defaults", () => {
|
||
const result = migrateEditorState(makeV9Persisted(), 9);
|
||
expect(result.endingsShown).toBe("");
|
||
expect(result.languagePatch).toBe("none");
|
||
expect(result.languagePatchCustom).toBe("");
|
||
expect(result.gameVersion).toBe("full_release");
|
||
expect(result.gameVersionCustom).toBe("");
|
||
expect(result.techNotes).toEqual([]);
|
||
});
|
||
|
||
it("preserves existing playthroughStatus and difficulty values", () => {
|
||
const result = migrateEditorState(
|
||
makeV9Persisted({
|
||
playthroughStatus: "blind",
|
||
difficulty: "hard",
|
||
difficultyCustomLabel: "Lethal",
|
||
}),
|
||
9,
|
||
);
|
||
expect(result.playthroughStatus).toBe("blind");
|
||
expect(result.difficulty).toBe("hard");
|
||
expect(result.difficultyCustomLabel).toBe("Lethal");
|
||
// New fields still get defaults.
|
||
expect(result.endingsShown).toBe("");
|
||
expect(result.languagePatch).toBe("none");
|
||
});
|
||
|
||
it("preserves existing contentWarnings and adds empty techNotes", () => {
|
||
const result = migrateEditorState(
|
||
makeV9Persisted({
|
||
contentWarnings: ["spoiler_story", "flashing_lights"],
|
||
}),
|
||
9,
|
||
);
|
||
expect(result.contentWarnings).toEqual(["spoiler_story", "flashing_lights"]);
|
||
expect(result.techNotes).toEqual([]);
|
||
});
|
||
|
||
it("coerces an invalid persisted languagePatch to 'none'", () => {
|
||
const result = migrateEditorState(makeV9Persisted({ languagePatch: "not_a_real_option" }), 9);
|
||
expect(result.languagePatch).toBe("none");
|
||
});
|
||
|
||
it("coerces an invalid persisted gameVersion to 'full_release'", () => {
|
||
const result = migrateEditorState(makeV9Persisted({ gameVersion: "definitely_not_valid" }), 9);
|
||
expect(result.gameVersion).toBe("full_release");
|
||
});
|
||
|
||
it("filters out unknown techNotes ids (defensive against hand-edited blobs)", () => {
|
||
const result = migrateEditorState(
|
||
makeV9Persisted({
|
||
techNotes: ["copyright_muted_sections", "ghost_id_xyz", "fps_drops_hardware"],
|
||
}),
|
||
9,
|
||
);
|
||
expect(result.techNotes).toEqual(["copyright_muted_sections", "fps_drops_hardware"]);
|
||
});
|
||
|
||
it("preserves valid techNotes values when migrating from a manually-bumped v10 blob", () => {
|
||
const result = migrateEditorState(
|
||
makeV9Persisted({ techNotes: ["loading_cut", "support_developers"] }),
|
||
9,
|
||
);
|
||
// v10 doesn't strip valid ids — only filters unknowns.
|
||
expect(result.techNotes).toEqual(["loading_cut", "support_developers"]);
|
||
});
|
||
|
||
it("returns a fresh initial state when persistedState is null/undefined", () => {
|
||
const fromNull = migrateEditorState(null, 9);
|
||
const fromUndefined = migrateEditorState(undefined, 9);
|
||
expect(fromNull.endingsShown).toBe("");
|
||
expect(fromUndefined.endingsShown).toBe("");
|
||
expect(fromNull.techNotes).toEqual([]);
|
||
expect(fromUndefined.techNotes).toEqual([]);
|
||
});
|
||
|
||
it("is idempotent — running the migration twice produces the same result", () => {
|
||
const once = migrateEditorState(makeV9Persisted(), 9);
|
||
const twice = migrateEditorState(once, 10);
|
||
expect(twice).toEqual(once);
|
||
});
|
||
});
|
||
|
||
describe("migrateEditorState — v10 → v11 (v0.13)", () => {
|
||
function makeV10Persisted(overrides: Record<string, unknown> = {}): Record<string, unknown> {
|
||
// v10 is v9 + the playthrough-notes / tech-notes fields. Easiest to
|
||
// build by routing v9 through the migration once and then apply
|
||
// overrides — keeps this test surface narrow even as the v9 base
|
||
// schema evolves.
|
||
const v10 = migrateEditorState(makeV9Persisted(), 9);
|
||
return { ...v10, ...overrides } as unknown as Record<string, unknown>;
|
||
}
|
||
|
||
it("back-fills the three v0.13 Gacha fields with safe defaults", () => {
|
||
const result = migrateEditorState(makeV10Persisted(), 10);
|
||
expect(result.characterName).toBe("");
|
||
expect(result.anniversaryYear).toBeNull();
|
||
expect(result.gachaVersion).toBe("");
|
||
});
|
||
|
||
it("preserves a valid persisted anniversaryYear in the 1–20 range", () => {
|
||
const result = migrateEditorState(makeV10Persisted({ anniversaryYear: 7 }), 10);
|
||
expect(result.anniversaryYear).toBe(7);
|
||
});
|
||
|
||
it("coerces out-of-range / non-integer anniversaryYear values to null", () => {
|
||
expect(
|
||
migrateEditorState(makeV10Persisted({ anniversaryYear: 0 }), 10).anniversaryYear,
|
||
).toBeNull();
|
||
expect(
|
||
migrateEditorState(makeV10Persisted({ anniversaryYear: 21 }), 10).anniversaryYear,
|
||
).toBeNull();
|
||
expect(
|
||
migrateEditorState(makeV10Persisted({ anniversaryYear: 2.5 }), 10).anniversaryYear,
|
||
).toBeNull();
|
||
expect(
|
||
migrateEditorState(makeV10Persisted({ anniversaryYear: "7" }), 10).anniversaryYear,
|
||
).toBeNull();
|
||
});
|
||
|
||
it("preserves existing characterName and gachaVersion values", () => {
|
||
const result = migrateEditorState(
|
||
makeV10Persisted({ characterName: "Furina", gachaVersion: "4.2" }),
|
||
10,
|
||
);
|
||
expect(result.characterName).toBe("Furina");
|
||
expect(result.gachaVersion).toBe("4.2");
|
||
});
|
||
});
|
||
|
||
describe("migrateEditorState — v14 → v15 (v0.30.0 Playtest)", () => {
|
||
// Build a pre-v15 blob by routing v9 through every prior migration, then
|
||
// strip the playtest keys so the v15 block is what supplies them.
|
||
function makeV14Persisted(overrides: Record<string, unknown> = {}): Record<string, unknown> {
|
||
const full = migrateEditorState(makeV9Persisted(), 9) as unknown as Record<string, unknown>;
|
||
delete full.playtestLink;
|
||
delete full.playtestPlatform;
|
||
delete full.playtestInvites;
|
||
return { ...full, ...overrides };
|
||
}
|
||
|
||
it("back-fills the playtest fields with safe defaults", () => {
|
||
const result = migrateEditorState(makeV14Persisted(), 14);
|
||
expect(result.playtestLink).toBe("");
|
||
expect(result.playtestPlatform).toBe("steam");
|
||
expect(result.playtestInvites).toBe(0);
|
||
});
|
||
|
||
it("clamps an over-cap persisted invite count to 100", () => {
|
||
const result = migrateEditorState(makeV14Persisted({ playtestInvites: 250 }), 14);
|
||
expect(result.playtestInvites).toBe(100);
|
||
});
|
||
|
||
it("coerces a decimal or negative invite count to 0", () => {
|
||
expect(migrateEditorState(makeV14Persisted({ playtestInvites: 2.5 }), 14).playtestInvites).toBe(
|
||
0,
|
||
);
|
||
expect(migrateEditorState(makeV14Persisted({ playtestInvites: -3 }), 14).playtestInvites).toBe(
|
||
0,
|
||
);
|
||
});
|
||
|
||
it("coerces an unknown persisted platform to the default", () => {
|
||
const result = migrateEditorState(makeV14Persisted({ playtestPlatform: "mystery" }), 14);
|
||
expect(result.playtestPlatform).toBe("steam");
|
||
});
|
||
|
||
it("preserves valid persisted playtest values", () => {
|
||
const result = migrateEditorState(
|
||
makeV14Persisted({
|
||
playtestLink: "https://dev.itch.io/my-game",
|
||
playtestPlatform: "itchio",
|
||
playtestInvites: 40,
|
||
}),
|
||
14,
|
||
);
|
||
expect(result.playtestLink).toBe("https://dev.itch.io/my-game");
|
||
expect(result.playtestPlatform).toBe("itchio");
|
||
expect(result.playtestInvites).toBe(40);
|
||
});
|
||
});
|
||
|
||
describe("migrateEditorState — v15 → v16 (v0.32.0 Community links)", () => {
|
||
// Build a pre-v16 blob by routing v9 through every prior migration, then
|
||
// strip the community keys so the v16 block is what supplies them.
|
||
function makeV15Persisted(overrides: Record<string, unknown> = {}): Record<string, unknown> {
|
||
const full = migrateEditorState(makeV9Persisted(), 9) as unknown as Record<string, unknown>;
|
||
delete full.messengerCommunityLink;
|
||
delete full.zaloGroupLink;
|
||
return { ...full, ...overrides };
|
||
}
|
||
|
||
it("back-fills the community link fields with empty strings", () => {
|
||
const result = migrateEditorState(makeV15Persisted(), 15);
|
||
expect(result.messengerCommunityLink).toBe("");
|
||
expect(result.zaloGroupLink).toBe("");
|
||
});
|
||
|
||
it("coerces non-string persisted community values to empty strings", () => {
|
||
const result = migrateEditorState(
|
||
makeV15Persisted({ messengerCommunityLink: 42, zaloGroupLink: null }),
|
||
15,
|
||
);
|
||
expect(result.messengerCommunityLink).toBe("");
|
||
expect(result.zaloGroupLink).toBe("");
|
||
});
|
||
|
||
it("preserves valid persisted community links", () => {
|
||
const result = migrateEditorState(
|
||
makeV15Persisted({
|
||
messengerCommunityLink: "https://m.me/ch/mychannel",
|
||
zaloGroupLink: "https://zalo.me/g/abc123",
|
||
}),
|
||
15,
|
||
);
|
||
expect(result.messengerCommunityLink).toBe("https://m.me/ch/mychannel");
|
||
expect(result.zaloGroupLink).toBe("https://zalo.me/g/abc123");
|
||
});
|
||
});
|
||
|
||
describe("migrateEditorState — v16 → v17 (v0.33.0 Community expansion)", () => {
|
||
// Route v9 through every prior migration, then strip the v17 keys so the
|
||
// v17 block is what supplies them.
|
||
function makeV16Persisted(overrides: Record<string, unknown> = {}): Record<string, unknown> {
|
||
const full = migrateEditorState(makeV9Persisted(), 9) as unknown as Record<string, unknown>;
|
||
delete full.signalGroupLink;
|
||
delete full.instagramGroupLink;
|
||
delete full.facebookGroupLink;
|
||
return { ...full, ...overrides };
|
||
}
|
||
|
||
it("back-fills the new community link fields with empty strings", () => {
|
||
const result = migrateEditorState(makeV16Persisted(), 16);
|
||
expect(result.signalGroupLink).toBe("");
|
||
expect(result.instagramGroupLink).toBe("");
|
||
expect(result.facebookGroupLink).toBe("");
|
||
});
|
||
|
||
it("coerces non-string persisted values to empty strings", () => {
|
||
const result = migrateEditorState(
|
||
makeV16Persisted({
|
||
signalGroupLink: 7,
|
||
instagramGroupLink: null,
|
||
facebookGroupLink: {},
|
||
}),
|
||
16,
|
||
);
|
||
expect(result.signalGroupLink).toBe("");
|
||
expect(result.instagramGroupLink).toBe("");
|
||
expect(result.facebookGroupLink).toBe("");
|
||
});
|
||
|
||
it("preserves valid persisted new community links", () => {
|
||
const result = migrateEditorState(
|
||
makeV16Persisted({
|
||
signalGroupLink: "https://signal.group/#abc123",
|
||
instagramGroupLink: "https://ig.me/j/xyz789",
|
||
facebookGroupLink: "https://facebook.com/groups/mygroup",
|
||
}),
|
||
16,
|
||
);
|
||
expect(result.signalGroupLink).toBe("https://signal.group/#abc123");
|
||
expect(result.instagramGroupLink).toBe("https://ig.me/j/xyz789");
|
||
expect(result.facebookGroupLink).toBe("https://facebook.com/groups/mygroup");
|
||
});
|
||
|
||
it("lifts a legacy social.fb_group value into facebookGroupLink and drops the dead key", () => {
|
||
const result = migrateEditorState(
|
||
makeV16Persisted({
|
||
social: {
|
||
fb_group: "https://facebook.com/groups/mygroup",
|
||
twitter: "myhandle",
|
||
},
|
||
}),
|
||
16,
|
||
);
|
||
expect(result.facebookGroupLink).toBe("https://facebook.com/groups/mygroup");
|
||
expect(result.social.fb_group).toBeUndefined();
|
||
// Other social entries survive the lift.
|
||
expect(result.social.twitter).toBe("myhandle");
|
||
});
|
||
|
||
it("does not overwrite an explicit facebookGroupLink with the legacy value", () => {
|
||
const result = migrateEditorState(
|
||
makeV16Persisted({
|
||
facebookGroupLink: "https://facebook.com/groups/explicit",
|
||
social: { fb_group: "https://facebook.com/groups/legacy" },
|
||
}),
|
||
16,
|
||
);
|
||
expect(result.facebookGroupLink).toBe("https://facebook.com/groups/explicit");
|
||
expect(result.social.fb_group).toBeUndefined();
|
||
});
|
||
});
|
||
|
||
describe("migrateEditorState — v17 → v18 (v0.34.0 Email split)", () => {
|
||
// Route v9 through every prior migration, then strip the v18 keys so the
|
||
// v18 block is what supplies them.
|
||
function makeV17Persisted(overrides: Record<string, unknown> = {}): Record<string, unknown> {
|
||
const full = migrateEditorState(makeV9Persisted(), 9) as unknown as Record<string, unknown>;
|
||
delete full.adEmail;
|
||
delete full.gameKeyEmail;
|
||
return { ...full, ...overrides };
|
||
}
|
||
|
||
it("back-fills the new email fields with empty strings", () => {
|
||
const result = migrateEditorState(makeV17Persisted(), 17);
|
||
expect(result.adEmail).toBe("");
|
||
expect(result.gameKeyEmail).toBe("");
|
||
});
|
||
|
||
it("coerces non-string persisted values to empty strings", () => {
|
||
const result = migrateEditorState(makeV17Persisted({ adEmail: 42, gameKeyEmail: null }), 17);
|
||
expect(result.adEmail).toBe("");
|
||
expect(result.gameKeyEmail).toBe("");
|
||
});
|
||
|
||
it("preserves valid persisted email values", () => {
|
||
const result = migrateEditorState(
|
||
makeV17Persisted({
|
||
adEmail: "ads@example.com",
|
||
gameKeyEmail: "games@example.com",
|
||
}),
|
||
17,
|
||
);
|
||
expect(result.adEmail).toBe("ads@example.com");
|
||
expect(result.gameKeyEmail).toBe("games@example.com");
|
||
});
|
||
|
||
it("leaves the existing contactEmail untouched (reused as the Contact line)", () => {
|
||
const result = migrateEditorState(makeV17Persisted({ contactEmail: "hello@channel.com" }), 17);
|
||
expect(result.contactEmail).toBe("hello@channel.com");
|
||
});
|
||
});
|
||
|
||
describe("migrateEditorState — v18 → v19 (v1.0.0 GPU catalog)", () => {
|
||
it("converts a v0.13 GPU tuple to the catalog id", () => {
|
||
const result = migrateEditorState({ rig: { gpu: "nvidia|rtx_50|RTX 5080", cpu: "x" } }, 18);
|
||
expect(result.rig).toEqual({ gpu: "gpu:nvidia-rtx-5080", cpu: "x" });
|
||
});
|
||
|
||
it("keeps a card the catalog doesn't know as its full name", () => {
|
||
const result = migrateEditorState({ rig: { gpu: "amd|rx_9000|RX 9090 XT" } }, 18);
|
||
expect(result.rig.gpu).toBe("AMD Radeon RX 9090 XT");
|
||
});
|
||
|
||
it("survives a missing or malformed rig", () => {
|
||
expect(migrateEditorState({ rig: null }, 18).rig).toEqual({});
|
||
expect(migrateEditorState({}, 18).rig).toEqual({});
|
||
});
|
||
|
||
it("does not touch the rig of a v19 draft", () => {
|
||
const rig = { gpu: "gpu:amd-rx-7800-xt" };
|
||
expect(migrateEditorState({ rig }, 19).rig).toEqual(rig);
|
||
});
|
||
});
|
||
|
||
describe("migrateEditorState — v19 → v20 (v1.1.0 copyright email)", () => {
|
||
// Route v9 through every prior migration, then strip the v20 key so the
|
||
// v20 block is what supplies it.
|
||
function makeV19Persisted(overrides: Record<string, unknown> = {}): Record<string, unknown> {
|
||
const full = migrateEditorState(makeV9Persisted(), 9) as unknown as Record<string, unknown>;
|
||
delete full.copyrightEmail;
|
||
return { ...full, ...overrides };
|
||
}
|
||
|
||
it("back-fills copyrightEmail with an empty string", () => {
|
||
expect(migrateEditorState(makeV19Persisted(), 19).copyrightEmail).toBe("");
|
||
});
|
||
|
||
it("coerces a non-string persisted value to an empty string", () => {
|
||
expect(migrateEditorState(makeV19Persisted({ copyrightEmail: 42 }), 19).copyrightEmail).toBe(
|
||
"",
|
||
);
|
||
expect(migrateEditorState(makeV19Persisted({ copyrightEmail: null }), 19).copyrightEmail).toBe(
|
||
"",
|
||
);
|
||
});
|
||
|
||
it("preserves a valid persisted value", () => {
|
||
const result = migrateEditorState(makeV19Persisted({ copyrightEmail: "dmca@example.com" }), 19);
|
||
expect(result.copyrightEmail).toBe("dmca@example.com");
|
||
});
|
||
|
||
it("leaves saved purpose emails alone, even without a purpose word", () => {
|
||
// Strict Mode flags these; a migration must never delete the user's data.
|
||
const result = migrateEditorState(
|
||
makeV19Persisted({ adEmail: "hello@channel.com", gameKeyEmail: "me@channel.com" }),
|
||
19,
|
||
);
|
||
expect(result.adEmail).toBe("hello@channel.com");
|
||
expect(result.gameKeyEmail).toBe("me@channel.com");
|
||
});
|
||
});
|
||
|
||
describe("migrateEditorState — v20 → v21 (v1.5.0 upscaled video)", () => {
|
||
function makeV20Persisted(overrides: Record<string, unknown> = {}): Record<string, unknown> {
|
||
const full = migrateEditorState(makeV9Persisted(), 9) as unknown as Record<string, unknown>;
|
||
delete full.upscaledFrom;
|
||
return { ...full, ...overrides };
|
||
}
|
||
|
||
it("back-fills upscaledFrom as not upscaled", () => {
|
||
expect(migrateEditorState(makeV20Persisted(), 20).upscaledFrom).toBe("");
|
||
});
|
||
|
||
it("coerces an unknown or non-string value to not upscaled", () => {
|
||
expect(migrateEditorState(makeV20Persisted({ upscaledFrom: "2K" }), 20).upscaledFrom).toBe("");
|
||
expect(migrateEditorState(makeV20Persisted({ upscaledFrom: 1440 }), 20).upscaledFrom).toBe("");
|
||
expect(migrateEditorState(makeV20Persisted({ upscaledFrom: null }), 20).upscaledFrom).toBe("");
|
||
});
|
||
|
||
it("keeps a valid value, and running it again changes nothing", () => {
|
||
const once = migrateEditorState(
|
||
makeV20Persisted({ resolution: "4K", upscaledFrom: "1440p" }),
|
||
20,
|
||
);
|
||
expect(once.upscaledFrom).toBe("1440p");
|
||
expect(once.resolution).toBe("4K");
|
||
expect(migrateEditorState({ ...once }, 20)).toEqual(once);
|
||
});
|
||
});
|
||
|
||
describe("migrateEditorState — v21 → v22 (v1.6.0 custom frame generation, DLSS 5)", () => {
|
||
function makeV21Persisted(overrides: Record<string, unknown> = {}): Record<string, unknown> {
|
||
const full = migrateEditorState(makeV9Persisted(), 9) as unknown as Record<string, unknown>;
|
||
delete full.frameGenCustom;
|
||
delete full.dlssNeuralRendering;
|
||
return { ...full, ...overrides };
|
||
}
|
||
|
||
it("back-fills an empty custom frame generation and DLSS 5 off", () => {
|
||
const migrated = migrateEditorState(makeV21Persisted(), 21);
|
||
expect(migrated.frameGenCustom).toBe("");
|
||
expect(migrated.dlssNeuralRendering).toBe(false);
|
||
});
|
||
|
||
it("coerces values of the wrong type", () => {
|
||
const migrated = migrateEditorState(
|
||
makeV21Persisted({ frameGenCustom: 6, dlssNeuralRendering: "yes" }),
|
||
21,
|
||
);
|
||
expect(migrated.frameGenCustom).toBe("");
|
||
expect(migrated.dlssNeuralRendering).toBe(false);
|
||
});
|
||
|
||
it("keeps the frame-gen choices a v21 draft made, and running it again changes nothing", () => {
|
||
const once = migrateEditorState(
|
||
makeV21Persisted({
|
||
frameGenVendor: "nvidia",
|
||
frameGenMultiplier: "x4",
|
||
upscaleQuality: "quality",
|
||
}),
|
||
21,
|
||
);
|
||
expect(once.frameGenVendor).toBe("nvidia");
|
||
expect(once.frameGenMultiplier).toBe("x4");
|
||
expect(once.upscaleQuality).toBe("quality");
|
||
expect(migrateEditorState({ ...once }, 21)).toEqual(once);
|
||
});
|
||
|
||
it("keeps values a newer draft already holds", () => {
|
||
const migrated = migrateEditorState(
|
||
makeV21Persisted({ frameGenCustom: "NVIDIA Smooth Motion", dlssNeuralRendering: true }),
|
||
21,
|
||
);
|
||
expect(migrated.frameGenCustom).toBe("NVIDIA Smooth Motion");
|
||
expect(migrated.dlssNeuralRendering).toBe(true);
|
||
});
|
||
});
|