Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. import PacMan from '../src/pacman-core/PacMan';
  2.  
  3.  
  4. test('tick pacman when is in super state', () => {
  5. const pacman = new PacMan({ state: true, superTime: 200 });
  6. pacman.tick();
  7. expect(pacman.state).toBe(true);
  8. expect(pacman.superTime).toBe(199);
  9. });
  10. test('tick pacman when state super time one', () => {
  11. const pacman = new PacMan({ state: true, superTime: 1 });
  12. pacman.tick();
  13. expect(pacman.state).toBe(false);
  14. expect(pacman.superTime).toBe(0);
  15. });
  16. test('tick pacman when state normal time zero', () => {
  17. const pacman = new PacMan({ state: false, superTime: 0 });
  18. pacman.tick();
  19. expect(pacman.state).toBe(false);
  20. expect(pacman.superTime).toBe(0);
  21. });
  22.  
  23.  
  24. test('eat ball when balls < 40', () => {
  25.  
  26. const pacman = new PacMan({ballCount:20});
  27. pacman.eatBall(false);
  28. expect(pacman.ballCount).toBe(21);
  29.  
  30. })
  31.  
  32. test('eat ball when balls > 40', () => {
  33.  
  34. const pacman = new PacMan({ballCount:41, level: 1});
  35. let current_level = pacman.level;
  36. pacman.eatBall(false);
  37. expect(pacman.ballCount).toBe(0);
  38. expect(pacman.level).toBe(2);
  39.  
  40.  
  41. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement