From bfd8b0af846d4ece3b7692dfb4b8817b538f7546 Mon Sep 17 00:00:00 2001 From: SukkaW Date: Mon, 16 Sep 2019 17:58:23 +0800 Subject: [PATCH] fix: remove duplicated default path --- lib/plugins/helper/full_url_for.js | 2 +- test/scripts/helpers/full_url_for.js | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/plugins/helper/full_url_for.js b/lib/plugins/helper/full_url_for.js index 323a8b1564..997db74ab6 100755 --- a/lib/plugins/helper/full_url_for.js +++ b/lib/plugins/helper/full_url_for.js @@ -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); }; diff --git a/test/scripts/helpers/full_url_for.js b/test/scripts/helpers/full_url_for.js index 0c7755992f..bcd53f2de5 100755 --- a/test/scripts/helpers/full_url_for.js +++ b/test/scripts/helpers/full_url_for.js @@ -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');