From 42dd30f6930e20530c6c9e4efecd0b088098ce9d Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Sat, 24 Feb 2024 11:20:37 +0100 Subject: [PATCH] add simple unit test --- ci.sh | 2 +- tests/Unit/ExampleTest.php | 18 --------------- tests/Unit/Models/ChatLogTest.php | 37 +++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 19 deletions(-) delete mode 100644 tests/Unit/ExampleTest.php create mode 100644 tests/Unit/Models/ChatLogTest.php diff --git a/ci.sh b/ci.sh index 602f7b5..b57b3b5 100755 --- a/ci.sh +++ b/ci.sh @@ -5,5 +5,5 @@ php artisan key:generate php artisan migrate:fresh npm clean-install npm run production -nice php artisan test --without-tty --coverage-html /var/www/coverage/alttp/php +XDEBUG_MODE=coverage nice php artisan test --without-tty --coverage-html /var/www/coverage/alttp/php nice npm run test -- --coverage --coverageDirectory /var/www/coverage/alttp/js --coverageReporters html --collectCoverageFrom 'resources/js/**' diff --git a/tests/Unit/ExampleTest.php b/tests/Unit/ExampleTest.php deleted file mode 100644 index e5c5fef..0000000 --- a/tests/Unit/ExampleTest.php +++ /dev/null @@ -1,18 +0,0 @@ -assertTrue(true); - } -} diff --git a/tests/Unit/Models/ChatLogTest.php b/tests/Unit/Models/ChatLogTest.php new file mode 100644 index 0000000..72fd172 --- /dev/null +++ b/tests/Unit/Models/ChatLogTest.php @@ -0,0 +1,37 @@ +assertEquals('gg', ChatLog::classify('gg')); + $this->assertEquals('gg', ChatLog::classify('GG')); + $this->assertEquals('gg', ChatLog::classify('Gg')); + + $this->assertEquals('gl', ChatLog::classify('glhf')); + $this->assertEquals('gl', ChatLog::classify('gl & hf')); + + $this->assertEquals('hi', ChatLog::classify('hi')); + $this->assertEquals('hi', ChatLog::classify('hallo')); + + $this->assertEquals('hype', ChatLog::classify('122 Hype!')); + + $this->assertEquals('number', ChatLog::classify('13')); + $this->assertEquals('number', ChatLog::classify('22')); + + $this->assertEquals('lol', ChatLog::classify('haha')); + $this->assertEquals('lol', ChatLog::classify('KEKW')); + $this->assertEquals('lol', ChatLog::classify('LUL')); + + $this->assertEquals('o7', ChatLog::classify('o7')); + + $this->assertEquals('pog', ChatLog::classify('Pog')); + + $this->assertEquals('unclassified', ChatLog::classify('')); + } + +} -- 2.39.2