@@ -22,6 +22,7 @@ function makeState(id: string): GameState {
|
||||
},
|
||||
events: [],
|
||||
pending: [],
|
||||
version: 1,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -54,6 +55,11 @@ describe('openDb', () => {
|
||||
expect(db.load('a')?.events).toHaveLength(1);
|
||||
expect([...db.listIds()].sort()).toEqual(['a', 'b']); // still two rows
|
||||
|
||||
// the monotonic version is persisted with the state and round-trips
|
||||
s.version = 3;
|
||||
db.save(s);
|
||||
expect(db.load('a')?.version).toBe(3);
|
||||
|
||||
db.close();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user