@@ -0,0 +1,22 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { freshPlayer } from './_setup/harness.js';
|
||||
|
||||
describe('e2e-prod: storage', () => {
|
||||
it('save -> get -> delete round-trip', async () => {
|
||||
const client = await freshPlayer();
|
||||
const payload = JSON.stringify({ level: 7 });
|
||||
const item = { id: 'slot_1', type: 'savegame', data: payload };
|
||||
|
||||
await client.storage.save([item]);
|
||||
|
||||
// The server may assign its own item id, so match on type + data, not the client id.
|
||||
// v0.2 fetches the whole storage; filtering by type is client-side.
|
||||
const got = await client.storage.reload();
|
||||
expect(got.items?.some((i) => i.type === 'savegame' && i.data === payload)).toBe(true);
|
||||
|
||||
await client.storage.delete('savegame');
|
||||
|
||||
const after = await client.storage.reload();
|
||||
expect(after.items?.some((i) => i.data === payload)).toBeFalsy();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user