Skip to content

Commit

Permalink
feat(followapi.ts): add 'followArtist'
Browse files Browse the repository at this point in the history
  • Loading branch information
adamgrieger committed Jun 13, 2020
1 parent e9d9f8b commit 115065c
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 @@ -37,6 +37,23 @@ describe('FollowApi', () => {
});
});

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

await follow.followArtist('foo');

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

describe('followArtists', () => {
it('should follow 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 @@ -35,6 +35,17 @@ export class FollowApi {
);
}

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

/**
* Follow Artists
*
Expand Down

0 comments on commit 115065c

Please sign in to comment.