Skip to content

Commit

Permalink
add test to ensure timelines are unique
Browse files Browse the repository at this point in the history
  • Loading branch information
hzrd149 committed Mar 5, 2025
1 parent bf53581 commit c861184
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion packages/core/src/event-store/__tests__/event-store.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe("verifyEvent", () => {
});
});

describe("deleted", () => {
describe("removed", () => {
it("should complete when event is removed", () => {
eventStore.add(profile);
const spy = subscribeSpyTo(eventStore.removed(profile.id));
Expand Down Expand Up @@ -268,6 +268,21 @@ describe("timeline", () => {
eventStore.add(user.profile({ name: "old-name" }, { created_at: profile.created_at - 1000 }));
expect(spy.getValues()).toEqual([[profile]]);
});

it("should return new array for every value", () => {
const first = user.note("first note");
const second = user.note("second note");
const third = user.note("third note");
eventStore.add(first);
const spy = subscribeSpyTo(eventStore.timeline({ kinds: [0] }));
eventStore.add(second);
eventStore.add(third);
const hasDuplicates = (arr: any[]) => {
return new Set(arr).size !== arr.length;
};

expect(hasDuplicates(spy.getValues())).toBe(false);
});
});

describe("replaceableSet", () => {
Expand Down

0 comments on commit c861184

Please sign in to comment.