forked from tonaljs/tonal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.ts
54 lines (48 loc) · 1.42 KB
/
test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import TimeSignature from "./index";
describe("time-signature", () => {
test("get", () => {
expect(TimeSignature.get("4/4")).toEqual({
empty: false,
name: "4/4",
type: "simple",
upper: 4,
lower: 4,
additive: [],
});
});
test("get invalid", () => {
expect(TimeSignature.get("0/0").empty).toBe(true);
});
test("simple", () => {
expect(TimeSignature.get("4/4").type).toEqual("simple");
expect(TimeSignature.get("3/4").type).toEqual("simple");
expect(TimeSignature.get("2/4").type).toEqual("simple");
expect(TimeSignature.get("2/2").type).toEqual("simple");
});
test("compound", () => {
expect(TimeSignature.get("3/8").type).toEqual("compound");
expect(TimeSignature.get("6/8").type).toEqual("compound");
expect(TimeSignature.get("9/8").type).toEqual("compound");
expect(TimeSignature.get("12/8").type).toEqual("compound");
});
test("irregular", () => {
expect(TimeSignature.get("2+3+3/8").type).toEqual("irregular");
expect(TimeSignature.get("3+2+2/8").type).toEqual("irregular");
});
test("irrational", () => {
expect(TimeSignature.get("12/10").type).toEqual("irrational");
expect(TimeSignature.get("12/19").type).toEqual("irrational");
});
test("names", () => {
expect(TimeSignature.names()).toEqual([
"4/4",
"3/4",
"2/4",
"2/2",
"12/8",
"9/8",
"6/8",
"3/8",
]);
});
});