feat: version 2 beta

This commit is contained in:
2025-04-25 22:39:47 +00:00
commit 1e58359905
75 changed files with 6899 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
import { assertEquals } from "@std/assert";
import { it } from "@std/testing/bdd";
import { nanoid } from "nanoid";
import type { EventStoreFactory } from "../../mocks/events.ts";
import { describe } from "../../utilities/describe.ts";
export default describe<EventStoreFactory>("relations", (getEventStore) => {
it("should create a new relation", async () => {
const { store } = await getEventStore();
const key = "sample";
const stream = nanoid();
await store.relations.insert(key, stream);
assertEquals(await store.relations.getByKey(key), [stream]);
});
it("should ignore duplicate relations", async () => {
const { store } = await getEventStore();
const key = "sample";
const stream = nanoid();
await store.relations.insertMany([
{ key, stream },
{ key, stream },
]);
await store.relations.insert(key, stream);
assertEquals(await store.relations.getByKey(key), [stream]);
});
});