feature: initial commit

This commit is contained in:
Andy Burke 2025-06-13 20:40:28 -07:00
commit ce024ba87a
17 changed files with 1141 additions and 0 deletions

View file

@ -0,0 +1,39 @@
import * as asserts from '@std/assert';
import * as fsdb from '../fsdb.ts';
import { get_data_dir } from './helpers.ts';
Deno.test({
name: 'store and retrieve an item',
permissions: {
env: true,
read: ['./'],
write: ['./data']
},
fn: async () => {
type ITEM = {
id: string;
value: string;
};
const items: fsdb.FSDB_COLLECTION<ITEM> = new fsdb.FSDB_COLLECTION<ITEM>({
name: 'test-02-items',
root: get_data_dir() + '/test-02-items'
});
asserts.assert(items);
const item = {
id: 'blah-fish-test-with-cozy-home-down-here-yall-work',
value: 'the blah fish test, of course'
};
const stored_item = await items.create(item);
asserts.assertObjectMatch(stored_item, item);
const fetched_item = await items.get(item.id);
asserts.assert(fetched_item);
asserts.assertObjectMatch(fetched_item, stored_item);
}
});