Skip to content

Commit

Permalink
Fix test case
Browse files Browse the repository at this point in the history
  • Loading branch information
bitshadow committed Dec 18, 2018
1 parent 98f1812 commit 4ed1ba8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ module.exports = (urlString, options) => {
urlString = urlObj.toString();

// Remove ending `/`
if (options.removeTrailingSlash || (urlObj.pathname === '/' && urlObj.hash === '')) {
if ((options.removeTrailingSlash || urlObj.pathname === '/') && urlObj.hash === '') {
urlString = urlString.replace(/\/$/, '');
}

Expand Down
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ test('removeTrailingSlash and removeDirectoryIndex options)', t => {
};
t.is(normalizeUrl('http://sindresorhus.com/path/', options1), 'http://sindresorhus.com/path');
t.is(normalizeUrl('http://sindresorhus.com/path/index.html', options1), 'http://sindresorhus.com/path');
t.is(normalizeUrl('http://sindresorhus.com/#/path/', options1), 'http://sindresorhus.com/#/path');
t.is(normalizeUrl('http://sindresorhus.com/#/path/', options1), 'http://sindresorhus.com/#/path/');

const options2 = {
removeTrailingSlash: false,
Expand Down

0 comments on commit 4ed1ba8

Please sign in to comment.