Front End Development Libraries - Build a Drum Machine Test 6 Fails

Test 6 requires that pressing a button on the keyboard makes the corresponding audio component play. I believe my code already achieves this effect, but I cannot get the test to pass.


Try logging out event.key inside the handlers and look at the console when running the tests.

Thank you, I figured it out! I had previously determined that event.key was lowercase whenever I press buttons on my keyboard, so I only converted the target of the comparison to lowercase. But it seems that when the tests are run, event.key becomes uppercase. I fixed it by converting both sides to lowercase. I actually didn’t realize that a KeyboardEvent would signify a key’s shiftedness in this way, and I was not expecting the tests to fire events using uppercase keys.