Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new test case for leading dots in file extension declaration. #518

Merged
merged 1 commit into from
Dec 13, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion tests/iconGenerator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ describe('generating icons', function () {
expect(iconGenerator.getPathToDirName(toDirName, fromDirPath)).toEqual(pathTo);
});

it('file extension should not have a leading dot', function () {
files.supported
.filter(function (file) { return !file.filename; })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that you've chosen to favor readability instead of performance by double looping over the files.supported collection, haven`t you?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeap. The impact isn't noticeable.

.forEach(function (file) {
file.extensions.forEach(function (extension) {
expect(extension.startsWith('.')).toBeFalsy();
});
});
});

it('ensures each supported file extension has an associated icon file', function () {
var suffix = '@2x';
var iconDirPath = iconGenerator.getPathToDirName('icons', '.');
Expand Down Expand Up @@ -144,7 +154,7 @@ describe('generating icons', function () {
var fileExtensions = iconGenerator.buildJsonStructure().files.names.fileExtensions;

files.supported
.filter(function (file) { return !file.filename && !file.languages; })
.filter(function (file) { return !file.filename; })
.forEach(function (file) {
var definition = '_f_' + file.icon;
file.extensions.forEach(function (extension) {
Expand Down