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 = new fsdb.FSDB_COLLECTION({ 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); } });