blob: b948d0910dd80028cefc3f397e4c5b0c87f1eed9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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);
});
});
|