Files

25 lines
1.2 KiB
TypeScript

import { createCatalog, Game } from '../../src/sim/catalog';
import type { Customer } from '../../src/sim/customers';
import { addToBackroom, ItemRef, stockSlot } from '../../src/sim/inventory';
import type { GameState } from '../../src/sim/state';
export const TEST_GAMES: Game[] = [
{ id: 'tetris', title: 'Tetris', console: 'GB', releaseDate: '1990-09-28', launchPriceCents: 3034, publisher: 'Nintendo', genre: 'Puzzle', basePopularity: 90 },
{ id: 'sml', title: 'Super Mario Land', console: 'GB', releaseDate: '1990-09-28', launchPriceCents: 3796, publisher: 'Nintendo', genre: 'Plateforme', basePopularity: 95 },
{ id: 'future', title: 'Future Game', console: 'GB', releaseDate: '1991-06-01', launchPriceCents: 3796, publisher: 'Test', genre: 'Action', basePopularity: 50 },
];
export function testCatalog() {
return createCatalog(TEST_GAMES);
}
export function makeCustomer(partial: Partial<Customer> = {}): Customer {
return { id: 1, intent: 'buy', cardId: null, wantedGameId: null, offered: null, ...partial };
}
/** Puts `qty` items straight onto a slot. */
export function stock(state: GameState, slotId: string, item: ItemRef, qty: number): void {
addToBackroom(state.inventory, item, qty);
stockSlot(state.inventory, slotId, item, qty);
}