From aa2df992e3ea9fa245c516a77b0235cf3ea2af85 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Thu, 26 Jun 2025 19:12:32 +0200 Subject: category test --- webAO/__tests__/isCategory.test.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 webAO/__tests__/isCategory.test.ts (limited to 'webAO/__tests__/isCategory.test.ts') 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 -- cgit