Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for RecentListens #810

Merged
merged 14 commits into from
Apr 30, 2020

Conversation

ishaanshah
Copy link
Collaborator

Description

Adds tests for the RecentListens.tsx file

Note: This is a continuation of #797

The function was trying to modify a const, which led to
weird behaviour. I also added a new prop json with
just a single listen so that it's easier to reason
about the test.
The spy didn't work because instance.socket was getting
assigned a new value in the function, which meant that
we were spying on the wrong thing.

The test still fails but that is an unrelated issue. The
callback cannot be expected to be called without an
actual connection happening.
@paramsingh
Copy link
Collaborator

@ishaanshah i've fixed the problems you mentioned in the two commits I added, take a look. the test still fails because the expect(handler).toHaveBeenCalled is incorrect. The handler won't be called until an actual connection happens which we do not want in tests.

@ishaanshah ishaanshah marked this pull request as ready for review April 30, 2020 09:51
@ishaanshah ishaanshah changed the title [WIP] Add tests for RecentListens Add tests for RecentListens Apr 30, 2020
Copy link
Collaborator

@paramsingh paramsingh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@paramsingh paramsingh merged commit 379f540 into metabrainz:master Apr 30, 2020
@ishaanshah ishaanshah deleted the recent_listen_test branch May 3, 2020 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants