Skip to content

Commit

Permalink
fix: remove duplicated default path
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW committed Sep 16, 2019
1 parent 67ef653 commit bfd8b0a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/plugins/helper/full_url_for.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
const { full_url_for } = require('hexo-util');

module.exports = function(path = '/') {
module.exports = function(path) {
return full_url_for.call(this, path);
};
12 changes: 5 additions & 7 deletions test/scripts/helpers/full_url_for.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@

describe('full_url_for', () => {
const ctx = {
config: {}
config: { url: 'https://example.com' }
};

const fullUrlFor = require('../../../lib/plugins/helper/full_url_for').bind(ctx);

it('internal url', () => {
ctx.config.root = '/';
fullUrlFor('index.html').should.eql(ctx.config.url + '/index.html');
fullUrlFor('/').should.eql(ctx.config.url + '/');
fullUrlFor('/index.html').should.eql(ctx.config.url + '/index.html');
it('no path input', () => {
fullUrlFor().should.eql(ctx.config.url + '/');
});

ctx.config.root = '/blog/';
it('internal url', () => {
fullUrlFor('index.html').should.eql(ctx.config.url + '/index.html');
fullUrlFor('/').should.eql(ctx.config.url + '/');
fullUrlFor('/index.html').should.eql(ctx.config.url + '/index.html');
Expand Down

0 comments on commit bfd8b0a

Please sign in to comment.