feat(perk): Добавлен бонус увеличивающий размер ракетки

This commit is contained in:
Ilia Mashkov
2026-07-19 15:32:09 +03:00
parent 511b20c939
commit b7e16f86ea
5 changed files with 33 additions and 9 deletions
+12
View File
@@ -1,3 +1,4 @@
import { PADDLE_WIDE_WIDTH } from '../../config';
import { Perk } from '../../entities/perk/perk';
import { Game } from '../../game';
import { updatePerks } from './updatePerks';
@@ -36,6 +37,17 @@ describe('updatePerks', () => {
expect(game.ball.speed).toBeLessThan(speedBefore);
});
it('Ловит бонус wide, расширяет ракетку до фиксированной ширины', () => {
const game = new Game([[[1]]]);
const { paddle } = game;
game.perks.push(new Perk(paddle.x, paddle.y - 1, 10, 10, 'wide', 0));
updatePerks(game, 600, 1);
expect(game.perks).toHaveLength(0);
expect(paddle.width).toBe(PADDLE_WIDE_WIDTH);
});
it('Убирает бонус, улетевший за нижнюю границу', () => {
const game = new Game([[[1]]]);
game.perks.push(new Perk(0, 601, 10, 10, 'slow', 0));