19 lines
709 B
TypeScript
19 lines
709 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { InMemoryAchievementRepository } from './InMemoryAchievementRepository';
|
|
|
|
describe('adapters/persistence/inmemory/achievement/InMemoryAchievementRepository', () => {
|
|
it('saves and queries achievements', async () => {
|
|
const repo = new InMemoryAchievementRepository();
|
|
|
|
const achievement: { id: string } = { id: 'a1' };
|
|
|
|
await repo.save(achievement as unknown as Parameters<InMemoryAchievementRepository['save']>[0]);
|
|
|
|
const found = await repo.findById('a1');
|
|
expect((found as { id: string } | null)?.id).toBe('a1');
|
|
|
|
const all = await repo.findAll();
|
|
expect(all.map(a => (a as { id: string }).id)).toContain('a1');
|
|
});
|
|
});
|