Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

Commit

Permalink
Fix incorrect endpoint for deleting subreddit images (fixes #125)
Browse files Browse the repository at this point in the history
  • Loading branch information
not-an-aardvark committed Jan 6, 2018
1 parent f5fd2f9 commit 103f42f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/objects/Subreddit.js
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ const Subreddit = class Subreddit extends RedditContent {
*/
deleteImage ({image_name, imageName = image_name}) {
return this._post({
uri: `r/${this.display_name}/api/delete_sr_image`,
uri: `r/${this.display_name}/api/delete_sr_img`,
form: {api_type, img_name: imageName}
}).then(handleJsonErrors(this));
}
Expand Down
7 changes: 7 additions & 0 deletions test/snoowrap.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,13 @@ describe('snoowrap', function () {
}
await subreddit.upload_header_image({file: 'test/test_image.png'});
});
it('can upload/delete images to a subreddit from the filesystem', async function () {
if (isBrowser) {
return this.skip();
}
await subreddit.upload_stylesheet_image({name: 'foo', file: 'test/test_image.png', imageType: 'png'});
await subreddit.deleteImage({imageName: 'foo'});
});
it("can get a subreddit's rules", async () => {
const rules_obj = await subreddit.get_rules();
expect(rules_obj.rules[0].short_name).to.equal('Rule 1: No breaking the rules');
Expand Down

0 comments on commit 103f42f

Please sign in to comment.