A calm place to write long-form, and publish it to the open social web.
skypress.blog/
1import { describe, it, expect } from 'vitest';
2import { createMemoryAssetStore } from './asset-store';
3
4describe( 'createMemoryAssetStore', () => {
5 it( 'puts, merges, reads all, and clears', async () => {
6 const store = createMemoryAssetStore();
7 await store.put( { a0: 'data:1' } );
8 await store.put( { a1: 'data:2' } );
9 expect( await store.getAll() ).toEqual( { a0: 'data:1', a1: 'data:2' } );
10 await store.clear();
11 expect( await store.getAll() ).toEqual( {} );
12 } );
13
14 it( 'replaces a key on re-put', async () => {
15 const store = createMemoryAssetStore();
16 await store.put( { a0: 'data:1' } );
17 await store.put( { a0: 'data:CHANGED' } );
18 expect( await store.getAll() ).toEqual( { a0: 'data:CHANGED' } );
19 } );
20} );