describe('setPreset', function() { it('should send the right preset recommended by Bosh for the BMM150 magnetometer to the device', function() { for(var i = 0; i< presets.length; i++) { magnetometer.setPreset(presets[i].preset); expect(device.send).toHaveBeenCalled(); expect(device.buffers[0]).toEqual(presets[i].expected[0]); expect(device.buffers[1]).toEqual(presets[i].expected[1]); device.reset(); } }); });