File size: 1,335 Bytes
f23825d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import TrackMute from "./TrackMute"

describe("TrackMute", () => {
  it("not muted by default", () => {
    const t = new TrackMute()
    expect(t.isMuted(0)).toBeFalsy()
    expect(t.isMuted(100)).toBeFalsy()
  })

  it("mute", () => {
    const t = new TrackMute()
    expect(t.isMuted(0)).toBeFalsy()
    t.mute(0)
    expect(t.isMuted(0)).toBeTruthy()
    expect(t.shouldPlayTrack(0)).toBeFalsy()
    t.unmute(0)
    expect(t.isMuted(0)).toBeFalsy()
  })

  it("solo", () => {
    const t = new TrackMute()
    expect(t.isSolo(0)).toBeFalsy()
    t.solo(0)
    expect(t.isSolo(0)).toBeTruthy()
    expect(t.isSoloMode()).toBeTruthy()
    expect(t.isMuted(1)).toBeTruthy()
    expect(t.shouldPlayTrack(0)).toBeTruthy()
    expect(t.shouldPlayTrack(1)).toBeFalsy()
    t.solo(1)
    expect(t.isSolo(0)).toBeTruthy()
    expect(t.isSolo(1)).toBeTruthy()
    expect(t.isSoloMode()).toBeTruthy()
    expect(t.isMuted(0)).toBeFalsy()
    expect(t.isMuted(1)).toBeFalsy()
    expect(t.isMuted(2)).toBeTruthy()
    expect(t.shouldPlayTrack(0)).toBeTruthy()
    expect(t.shouldPlayTrack(1)).toBeTruthy()
    expect(t.shouldPlayTrack(2)).toBeFalsy()
    t.unsolo(0)
    expect(t.isSolo(0)).toBeFalsy()
    expect(t.isSoloMode()).toBeTruthy()
    t.unsolo(1)
    expect(t.isSolo(1)).toBeFalsy()
    expect(t.isSoloMode()).toBeFalsy()
  })
})