From 0e1fb4e21e9e49f12cd7ff711c1483234e5a2ebe Mon Sep 17 00:00:00 2001 From: uiolee <22849383+uiolee@users.noreply.github.com> Date: Tue, 23 Jan 2024 23:58:06 +0800 Subject: [PATCH] style: fix eslint --- lib/server.js | 2 +- test/index.js | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/server.js b/lib/server.js index cfdce60..588ed0e 100644 --- a/lib/server.js +++ b/lib/server.js @@ -75,6 +75,6 @@ function formatAddress(ip, port, root) { hostname = 'localhost'; } - let path = root.startsWith("/") ? root : `/${root}`; + const path = root.startsWith('/') ? root : `/${root}`; return new URL(`http://${hostname}:${port}${path}`).toString(); } diff --git a/test/index.js b/test/index.js index a5743e4..93d4277 100644 --- a/test/index.js +++ b/test/index.js @@ -290,7 +290,7 @@ describe('server', () => { }); it('logger', () => { - hexo.config.server.log = true + hexo.config.server.log = true; const spy = sinon.spy(); const stub = sinon.stub(morgan, 'format'); stub.callsFake(spy); @@ -302,8 +302,8 @@ describe('server', () => { return request(app).get('/bar/baz'); }).finally(() => { spy.called.should.be.true; - hexo.config.server.log = false - }) + hexo.config.server.log = false; + }); }); }); @@ -322,29 +322,29 @@ describe('server', () => { hexo.config.feed = { path: 'bar/baz.html', type: 'atom' - } + }; return Promise.using(prepareServer(), app => { return request(app).get('/bar/baz.html').expect('Content-Type', 'application/atom+xml'); - }) + }); }); it('feed - rss', () => { hexo.config.feed = { path: 'bar/baz.html', type: 'rss' - } + }; return Promise.using(prepareServer(), app => { return request(app).get('/bar/baz.html').expect('Content-Type', 'application/rss+xml'); - }) + }); }); it('feed - other', () => { hexo.config.feed = { path: 'bar/baz.html', type: '' - } + }; return Promise.using(prepareServer(), app => { return request(app).get('/bar/baz.html').expect('Content-Type', 'text/html'); - }) + }); }); });