Add proper tests for beat function