Skip to content

Commit

Permalink
Add initial Unit Test
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidoTek committed May 18, 2024
1 parent 1088ced commit bd48a84
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/test_util.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from pupgui2.util import *

from pupgui2.datastructures import SteamApp, LutrisGame, HeroicGame


def test_get_random_game_name():
""" test whether get_random_game_name returns a valid game name """
names = ["game", "A super cool game", "A game with a very long name that is very long", "0123456789"]

steam_app = [SteamApp() for _ in range(len(names))]
lutris_game = [LutrisGame() for _ in range(len(names))]
heroic_game = [HeroicGame() for _ in range(len(names))]

for i, name in enumerate(names):
steam_app[i].game_name = name
lutris_game[i].name = name
heroic_game[i].title = name

for i in range(10):
assert get_random_game_name(steam_app) in names
assert get_random_game_name(lutris_game) in names
assert get_random_game_name(heroic_game) in names

0 comments on commit bd48a84

Please sign in to comment.