diff --git a/src/generate/__tests__/fixtures/contributors.json b/src/generate/__tests__/fixtures/contributors.json index 7872bd3..7ede43c 100644 --- a/src/generate/__tests__/fixtures/contributors.json +++ b/src/generate/__tests__/fixtures/contributors.json @@ -25,6 +25,11 @@ "avatar_url": "https://avatars1.githubusercontent.com/u/1500684", "contributions": ["translation"] }, + "nocompletename": { + "login": "nocompletename", + "avatar_url": "https://avatars1.githubusercontent.com/u/1500684", + "contributions": ["translation"] + }, "nologin_badrole": { "name": "Wildly Misconfigured", "avatar_url": "https://avatars1.githubusercontent.com/u/1500684", diff --git a/src/generate/__tests__/format-contributor.js b/src/generate/__tests__/format-contributor.js index 9dd4b63..c158cb3 100644 --- a/src/generate/__tests__/format-contributor.js +++ b/src/generate/__tests__/format-contributor.js @@ -77,3 +77,13 @@ test('format contributor with no GitHub account', () => { expect(formatContributor(options, contributor)).toBe(expected) }) + +test('format contributor with no complete name', () => { + const contributor = contributors.nocompletename + const {options} = fixtures() + + const expected = + 'nocompletename
nocompletename
🌍' + + expect(formatContributor(options, contributor)).toBe(expected) +}) diff --git a/src/generate/format-contributor.js b/src/generate/format-contributor.js index 7966a93..9f489f4 100644 --- a/src/generate/format-contributor.js +++ b/src/generate/format-contributor.js @@ -17,7 +17,9 @@ const contributorTemplate = _.template( const defaultImageSize = 100 function defaultTemplate(templateData) { - const name = escapeName(templateData.contributor.name) + const rawName = + templateData.contributor.name || templateData.contributor.login + const name = escapeName(rawName) const avatar = avatarTemplate( _.assign(templateData, { name,