feat(#60): nuclear/WMD — capability flag + strikes (region → no-man's-land, nation collapse + war capitulation, MAD retaliation) (v0.37.0)
CI / build + unit + e2e (pull_request) Successful in 2m33s
CI / build + unit + e2e (pull_request) Successful in 2m33s
This commit is contained in:
@@ -178,6 +178,28 @@ describe('openDb', () => {
|
||||
db.close();
|
||||
});
|
||||
|
||||
it('(v0.37.0 #60) a legacy row saved before the nation nuclear flag existed loads with it absent (not capable)', () => {
|
||||
const db = openDb(':memory:');
|
||||
// makeState has no nation.nuclear field — a pre-v0.37 save. The flag is
|
||||
// optional and not re-stamped by load, so an absent flag stays absent.
|
||||
db.save(makeState('legacy'));
|
||||
const loaded = db.load('legacy');
|
||||
expect(loaded).not.toBeNull();
|
||||
expect(loaded!.nations.uk.nuclear).toBeUndefined();
|
||||
db.close();
|
||||
});
|
||||
|
||||
it('(v0.37.0 #60) a set nation nuclear flag round-trips through save/load', () => {
|
||||
const db = openDb(':memory:');
|
||||
const s = makeState('nuc');
|
||||
s.nations.uk.nuclear = true; // armed (e.g. by a turn's nuclear.arm op)
|
||||
db.save(s);
|
||||
const loaded = db.load('nuc');
|
||||
expect(loaded).not.toBeNull();
|
||||
expect(loaded!.nations.uk.nuclear).toBe(true);
|
||||
db.close();
|
||||
});
|
||||
|
||||
it('delete removes a game by id and reports absence otherwise', () => {
|
||||
const db = openDb(':memory:');
|
||||
db.save(makeState('a'));
|
||||
|
||||
Reference in New Issue
Block a user