-
-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a snapshot test for the recent listens page (#797)
* Add a snapshot test * Lint the test file * Add the snapshot and fix test * Actually write the snapshot
- Loading branch information
1 parent
00ffdf6
commit 1efcab9
Showing
6 changed files
with
1,127 additions
and
9 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
listenbrainz/webserver/static/js/src/RecentListens.test.tsx
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import * as React from "react"; | ||
import { mount } from "enzyme"; | ||
|
||
import * as recentListensProfilePageProps from "./__mocks__/recentListensProfilePageProps.json"; | ||
|
||
import RecentListens, { ListensListMode } from "./RecentListens"; | ||
|
||
const { | ||
apiUrl, | ||
artistCount, | ||
haveListenCount, | ||
latestListenTs, | ||
latestSpotifyUri, | ||
listenCount, | ||
listens, | ||
mode, | ||
nextListenTs, | ||
previousListenTs, | ||
profileUrl, | ||
spotify, | ||
user, | ||
webSocketsServerUrl, | ||
} = recentListensProfilePageProps; | ||
|
||
const props = { | ||
apiUrl, | ||
artistCount, | ||
haveListenCount, | ||
latestListenTs, | ||
latestSpotifyUri, | ||
listenCount, | ||
listens, | ||
mode: mode as ListensListMode, | ||
nextListenTs, | ||
previousListenTs, | ||
profileUrl, | ||
spotify, | ||
user, | ||
webSocketsServerUrl, | ||
}; | ||
|
||
describe("RecentListens", () => { | ||
it("renders correctly on the profile page", () => { | ||
const wrapper = mount(<RecentListens {...props} />); | ||
expect(wrapper.html()).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains 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
Oops, something went wrong.