Created
July 9, 2019 11:08
-
-
Save icodejs/bd5adeec78abe62dd5e097913b70cad0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
SELECT_MIDI_CONTROLLER, | |
SELECT_NUMBER_OF_KEYBOARD_OCTAVES, | |
SET_WEB_MIDI_SUPPORTED, | |
} from './action-types'; | |
export const selectMidiController = ({ selectedDeviceName }) => ({ | |
type: SELECT_MIDI_CONTROLLER, | |
selectedDeviceName, | |
}); | |
export const selectNumberOfKeyboardOctaves = ({ | |
numberOfKeyboardOctaves | |
}) => ({ | |
type: SELECT_NUMBER_OF_KEYBOARD_OCTAVES, | |
numberOfKeyboardOctaves, | |
}) | |
export const setWebMidiSupported = ({ | |
webMidiSupported, | |
}) => ({ | |
type: SET_WEB_MIDI_SUPPORTED, | |
webMidiSupported, | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as actions from './actions'; | |
import * as types from './action-types'; | |
describe('actions', () => { | |
describe('selectMidiController', () => { | |
it('should select a midi controller available', () => { | |
const selectedDeviceName = 'fake-controller'; | |
const result = actions.selectMidiController({ | |
selectedDeviceName, | |
}); | |
const expectedResult = { | |
type: types.SELECT_MIDI_CONTROLLER, | |
selectedDeviceName, | |
} | |
expect(result).toEqual(expectedResult); | |
}) | |
}); | |
describe('selectNumberOfKeyboardOctaves', () => { | |
it('should set the number of keyboard octaves state', () => { | |
const numberOfKeyboardOctaves = 2; | |
const result = actions.selectNumberOfKeyboardOctaves({ | |
numberOfKeyboardOctaves, | |
}) | |
const expectedResult = { | |
type: types.SELECT_NUMBER_OF_KEYBOARD_OCTAVES, | |
numberOfKeyboardOctaves, | |
} | |
expect(result).toEqual(expectedResult); | |
}) | |
}); | |
describe("setWebmidiSupport", () => { | |
it("should set state relating to webmidi support", () => { | |
const webMidiSupported = 2; | |
const result = actions.setWebMidiSupported({ | |
webMidiSupported | |
}); | |
const expectedResult = { | |
type: types.SET_WEB_MIDI_SUPPORTED, | |
webMidiSupported | |
}; | |
expect(result).toEqual(expectedResult); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment