BUGFIX: Intelligence data is incorrectly migrated when Intelligence is not unlocked (#2660)

This commit is contained in:
catloversg
2026-04-15 05:20:01 +07:00
committed by GitHub
parent c5536d252b
commit 956e00f789
7 changed files with 44 additions and 2 deletions
+27
View File
@@ -105,4 +105,31 @@ describe("v3", () => {
`bitburnerSave_backup_2.8.1_${Math.round(lastUpdate / 1000)}.json.gz`,
);
});
describe("Intelligence migration bug", () => {
test("No change in exp and skill level", async () => {
const saveData = new Uint8Array(fs.readFileSync("test/jest/Migration/save-files/v2.8.1_SF1.1_SF10.3.gz"));
const mockedDownload = await loadGameFromSaveData(saveData);
for (const person of [Player, ...Player.sleeves]) {
expect(person.persistentIntelligenceData.exp).toStrictEqual(0);
expect(person.exp.intelligence).toStrictEqual(0);
expect(person.skills.intelligence).toStrictEqual(0);
}
expect(mockedDownload).toHaveBeenCalledWith(saveData, "bitburnerSave_backup_2.8.1_1776173824.json.gz");
});
test("Reset wrong exp and skill level", async () => {
const saveData = new Uint8Array(fs.readFileSync("test/jest/Migration/save-files/v3.0.0_int_migration_bug.gz"));
const mockedDownload = await loadGameFromSaveData(saveData);
for (const person of [Player, ...Player.sleeves]) {
expect(person.persistentIntelligenceData.exp).toStrictEqual(0);
expect(person.exp.intelligence).toStrictEqual(0);
expect(person.skills.intelligence).toStrictEqual(0);
}
expect(mockedDownload).not.toHaveBeenCalled();
});
});
});