コード例 #1
0
ファイル: reducer.js プロジェクト: quxbaz/loopda
    it("Adds a sample.", () => {
      const stateBefore = {samples: []}
      const action = audio.actions.addSample('hihat')
      const stateAfter = {samples: ['hihat']}
      expect(
        audio.reducer(stateBefore, action)
      ).toEqual(stateAfter)

      // Add one more sample
      expect(
        audio.reducer(stateAfter, audio.actions.addSample('kick'))
      ).toEqual({
        samples: ['hihat', 'kick']
      })
    })
コード例 #2
0
ファイル: reducer.js プロジェクト: quxbaz/loopda
 it("Does not add duplicate samples.", () => {
   const stateBefore = {samples: ['hihat']}
   const action = audio.actions.addSample('hihat')
   const stateAfter = {samples: ['hihat']}
   expect(
     audio.reducer(stateBefore, action)
   ).toEqual(stateAfter)
 })