diff options
Diffstat (limited to 'webAO')
| -rw-r--r-- | webAO/__tests__/isCategory.test.ts | 24 |
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 |
