Skip to content

Commit

Permalink
fix: more space in resource icon formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-north committed Sep 1, 2018
1 parent 97b2d2c commit b3c0faa
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions src/format/site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ const mdSiteIcons = (site: Resource): string => {
if (icons.length === 0) {
return '';
}
return ` ${icons.join('')} `;
return icons.join('');
};

const mdSiteDetails = (site: Resource): string => {
const parts: string[] = [mdSiteIcons(site), ' - ', site.description].filter(Boolean);
const parts = [mdSiteIcons(site), site.description].filter(Boolean).join(' - ');

if (parts.length > 0) {
return ` - ${parts.join(' ')}`;
return ` - ${parts}`;
}
return '';
};
Expand Down
24 changes: 12 additions & 12 deletions test/format-category-site-list-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ Category description`.trim(),
Category description
* [A thing](https://example.com/a-thing) - 💰📱🎮 Description of a thing
* [A thing](https://example.com/a-thing) - 💰📱🎮 Description of a thing
* [A thing](https://example.com/a-thing) - 💰📱🎮 Description of a thing`.trim(),
* [A thing](https://example.com/a-thing) - 💰📱🎮 - Description of a thing
* [A thing](https://example.com/a-thing) - 💰📱🎮 - Description of a thing
* [A thing](https://example.com/a-thing) - 💰📱🎮 - Description of a thing`.trim(),
);
}
@test
Expand Down Expand Up @@ -263,25 +263,25 @@ Description of test category 3`.trim(),
Category description
* [A thing](https://example.com/a-thing) - 💰📱🎮 Description of a thing
* [A thing](https://example.com/a-thing) - 💰📱🎮 Description of a thing
* [A thing](https://example.com/a-thing) - 💰📱🎮 Description of a thing
* [A thing](https://example.com/a-thing) - 💰📱🎮 - Description of a thing
* [A thing](https://example.com/a-thing) - 💰📱🎮 - Description of a thing
* [A thing](https://example.com/a-thing) - 💰📱🎮 - Description of a thing
## [Test Category 2](https://example.com/test-category-2)
Description of test category 2
* [A thing](https://example.com/a-thing) - 💰📱🎮 Description of a thing
* [A thing](https://example.com/a-thing) - 💰📱🎮 Description of a thing
* [A thing](https://example.com/a-thing) - 💰📱🎮 Description of a thing
* [A thing](https://example.com/a-thing) - 💰📱🎮 - Description of a thing
* [A thing](https://example.com/a-thing) - 💰📱🎮 - Description of a thing
* [A thing](https://example.com/a-thing) - 💰📱🎮 - Description of a thing
## [Test Category 3](https://example.com/test-category-3)
Description of test category 3
* [A thing](https://example.com/a-thing) - 💰📱🎮 Description of a thing
* [A thing](https://example.com/a-thing) - 💰📱🎮 Description of a thing
* [A thing](https://example.com/a-thing) - 💰📱🎮 Description of a thing
* [A thing](https://example.com/a-thing) - 💰📱🎮 - Description of a thing
* [A thing](https://example.com/a-thing) - 💰📱🎮 - Description of a thing
* [A thing](https://example.com/a-thing) - 💰📱🎮 - Description of a thing
`.trim(),
);
}
Expand Down
8 changes: 4 additions & 4 deletions test/format-generate-sitelist-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ class GenerateSitelistTests {
Category description 1
* [A thing](https://example.com/a-thing) - 💰📱🎮 Description of a thing
* [A thing](https://example.com/a-thing) - 💰📱🎮 Description of a thing
* [A thing](https://example.com/a-thing) - 💰📱🎮 - Description of a thing
* [A thing](https://example.com/a-thing) - 💰📱🎮 - Description of a thing
# [Test Category 2](https://example.com/test-category2)
Category description 2
* [A thing](https://example.com/a-thing) - 💰📱🎮 Description of a thing
* [A thing](https://example.com/a-thing) - 💰📱🎮 Description of a thing
* [A thing](https://example.com/a-thing) - 💰📱🎮 - Description of a thing
* [A thing](https://example.com/a-thing) - 💰📱🎮 - Description of a thing
`.trim(),
);
}
Expand Down
10 changes: 5 additions & 5 deletions test/format-site-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class SiteFormattingTests {
type: 'game',
url: 'https://example.com/test-site',
});
assert.equal(str, `* [Test Site](https://example.com/test-site) - ❖🎮 This is a description`);
assert.equal(str, `* [Test Site](https://example.com/test-site) - ❖🎮 - This is a description`);
}
@test
'icons are always in the same order'() {
Expand All @@ -30,7 +30,7 @@ class SiteFormattingTests {
type: 'game',
url: 'https://example.com/test-site',
});
assert.equal(str, `* [Test Site](https://example.com/test-site) - ❖🎮 This is a description`);
assert.equal(str, `* [Test Site](https://example.com/test-site) - ❖🎮 - This is a description`);
}
@test
'a game is formatted properly'() {
Expand All @@ -44,7 +44,7 @@ class SiteFormattingTests {
type: 'game',
url: 'https://example.com/test-site',
});
assert.equal(str, `* [Test Site](https://example.com/test-site) - 📱🎮 This is a description`);
assert.equal(str, `* [Test Site](https://example.com/test-site) - 📱🎮 - This is a description`);
}
@test
'a playground is formatted properly'() {
Expand All @@ -58,7 +58,7 @@ class SiteFormattingTests {
type: 'playground',
url: 'https://example.com/test-site',
});
assert.equal(str, `* [Test Site](https://example.com/test-site) - 🕸📱🏗 This is a description`);
assert.equal(str, `* [Test Site](https://example.com/test-site) - 🕸📱🏗 - This is a description`);
}
@test
'a paid app is formatted properly'() {
Expand All @@ -72,6 +72,6 @@ class SiteFormattingTests {
type: 'playground',
url: 'https://example.com/test-site',
});
assert.equal(str, `* [Test Site](https://example.com/test-site) - 💰🕸📱🏗 This is a description`);
assert.equal(str, `* [Test Site](https://example.com/test-site) - 💰🕸📱🏗 - This is a description`);
}
}

0 comments on commit b3c0faa

Please sign in to comment.