Skip to content

Commit

Permalink
feat(followapi.ts): add 'unfollowArtist'
Browse files Browse the repository at this point in the history
  • Loading branch information
adamgrieger committed Jun 14, 2020
1 parent b484a36 commit aeb9876
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/apis/FollowApi.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,23 @@ describe('FollowApi', () => {
});
});

describe('unfollowArtist', () => {
it('should unfollow an artist', async () => {
const { httpMock, follow } = setup();

await follow.unfollowArtist('foo');

expect(httpMock.delete).toBeCalledWith('/me/following', {
params: {
type: 'artist',
},
data: {
ids: ['foo'],
},
});
});
});

describe('unfollowArtists', () => {
it('should unfollow artists', async () => {
const { httpMock, follow } = setup();
Expand Down
11 changes: 11 additions & 0 deletions src/apis/FollowApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,17 @@ export class FollowApi {
});
}

/**
* Unfollow Artist
*
* Remove the current user as a follower of an artist.
*
* @param artistId The Spotify ID of the artist.
*/
unfollowArtist(artistId: string): Promise<void> {
return this.unfollowArtists([artistId]);
}

/**
* Unfollow Artists
*
Expand Down

0 comments on commit aeb9876

Please sign in to comment.