Skip to content
This repository has been archived by the owner on Feb 5, 2020. It is now read-only.

Commit

Permalink
insert into empty readme files
Browse files Browse the repository at this point in the history
  • Loading branch information
finnp committed Jan 23, 2017
1 parent a94e50c commit 8a61d3c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var markupBadgers = {
};

var addBadge = function(content, fileExt, imageUrl, linkUrl, altText) {
assert(content, 'readme content required');
assert(typeof content === 'string', 'readme content required');
assert(imageUrl, 'badge imageUrl required');
assert(linkUrl, 'badge linkUrl required');
assert(altText, 'badge altText required');
Expand Down
7 changes: 7 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,11 @@ describe('readme-badger', function() {

assert.equal(result, after);
});

it('inserts into empty files', function () {
var before = ''
var after = '\n\n[![Join the chat at https://gitter.im/myorg/myrepo](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/myorg/myrepo?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)'
var result = badger.addBadge(before, 'md', imageUrl, linkUrl, altText);
assert.equal(result, after)
})
});

0 comments on commit 8a61d3c

Please sign in to comment.