more seeds
This commit is contained in:
@@ -33,9 +33,13 @@ describe('InMemoryGameRepository', () => {
|
||||
});
|
||||
|
||||
describe('findAll', () => {
|
||||
it('should return an empty array', async () => {
|
||||
it('should return default seeded games', async () => {
|
||||
const result = await repository.findAll();
|
||||
expect(result).toEqual([]);
|
||||
|
||||
const ids = result.map((g) => g.id.toString());
|
||||
expect(ids).toEqual(expect.arrayContaining(['iracing', 'acc', 'f1-24', 'f1-23']));
|
||||
expect(result).toHaveLength(4);
|
||||
|
||||
expect(mockLogger.debug).toHaveBeenCalledWith('[InMemoryGameRepository] Finding all games.');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -7,6 +7,20 @@ export class InMemoryGameRepository implements IGameRepository {
|
||||
|
||||
constructor(private readonly logger: Logger) {
|
||||
this.logger.info('InMemoryGameRepository initialized.');
|
||||
this.seedDefaults();
|
||||
}
|
||||
|
||||
private seedDefaults(): void {
|
||||
const defaults = [
|
||||
Game.create({ id: 'iracing', name: 'iRacing' }),
|
||||
Game.create({ id: 'acc', name: 'Assetto Corsa Competizione' }),
|
||||
Game.create({ id: 'f1-24', name: 'F1 24' }),
|
||||
Game.create({ id: 'f1-23', name: 'F1 23' }),
|
||||
];
|
||||
|
||||
for (const game of defaults) {
|
||||
this.games.set(game.id.toString(), game);
|
||||
}
|
||||
}
|
||||
|
||||
async findById(id: string): Promise<Game | null> {
|
||||
|
||||
@@ -8,7 +8,7 @@ describe('InMemoryLeagueScoringPresetProvider', () => {
|
||||
it('should return all available presets', () => {
|
||||
const presets = provider.listPresets();
|
||||
|
||||
expect(presets).toHaveLength(3);
|
||||
expect(presets.length).toBeGreaterThanOrEqual(3);
|
||||
expect(presets).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
|
||||
Reference in New Issue
Block a user