aboutsummaryrefslogtreecommitdiff
path: root/webAO/__tests__/isCategory.test.ts
diff options
context:
space:
mode:
authorstonedDiscord <Tukz@gmx.de>2025-06-26 19:12:32 +0200
committerstonedDiscord <Tukz@gmx.de>2025-06-26 19:12:32 +0200
commitaa2df992e3ea9fa245c516a77b0235cf3ea2af85 (patch)
tree82402af31c79cf700264a69132ba1473d52dbe81 /webAO/__tests__/isCategory.test.ts
parente4ec5ceedb03ae7a23c7d2d8d6ce51c814b3e9a8 (diff)
category test
Diffstat (limited to 'webAO/__tests__/isCategory.test.ts')
-rw-r--r--webAO/__tests__/isCategory.test.ts24
1 files changed, 24 insertions, 0 deletions
diff --git a/webAO/__tests__/isCategory.test.ts b/webAO/__tests__/isCategory.test.ts
new file mode 100644
index 0000000..b948d09
--- /dev/null
+++ b/webAO/__tests__/isCategory.test.ts
@@ -0,0 +1,24 @@
+import { isCategory } from '../client/isCategory';
+
+describe('isCategory function', () => {
+ test('returns true if trackname starts with "=="', () => {
+ expect(isCategory('== Ace Attorney ==')).toBe(true);
+ });
+
+ test('returns true if trackname starts with "--"', () => {
+ expect(isCategory('-- Danganronpa --')).toBe(true);
+ });
+
+ test('returns true if trackname contains weird characters', () => {
+ expect(isCategory('--== JSR 📻 ==--')).toBe(true);
+ });
+
+ test('returns false if trackname does not start with a valid category indicator', () => {
+ expect(isCategory('sin.mp3')).toBe(false);
+ expect(isCategory('bogus.ogg')).toBe(false); // This has both indicators but in wrong format
+ });
+
+ test('returns false for an empty track name', () => {
+ expect(isCategory('')).toBe(false);
+ });
+}); \ No newline at end of file