Skip to content

Commit

Permalink
Merge branch 'master' into chore/hexo-log-4.0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshinorin authored Nov 21, 2022
2 parents 42313ba + f8cc2ee commit e91ef2a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
"hexo-cli": "^4.3.0",
"hexo-front-matter": "^4.0.0",
"hexo-fs": "^4.0.0",
"hexo-i18n": "^1.0.0",
"hexo-i18n": "^2.0.0",
"hexo-log": "^4.0.1",
"hexo-util": "^2.7.0",
"hexo-util": "^3.0.1",
"js-yaml": "^4.1.0",
"js-yaml-js-types": "^1.0.0",
"micromatch": "^4.0.4",
Expand Down
1 change: 1 addition & 0 deletions test/scripts/console/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ describe('Console', () => {
require('./list_categories');
require('./list_tags');
require('./list_page');
require('./list_route');
});
31 changes: 31 additions & 0 deletions test/scripts/console/list_route.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
'use strict';

const { stub, assert: sinonAssert } = require('sinon');

describe('Console list', () => {
const Hexo = require('../../../lib/hexo');
const hexo = new Hexo(__dirname);

const listRoutes = require('../../../lib/plugins/console/list/route').bind(hexo);
const { route } = hexo;

let logStub;

before(() => { logStub = stub(console, 'log'); });

afterEach(() => { logStub.reset(); });

after(() => { logStub.restore(); });

it('no route', () => {
listRoutes();
sinonAssert.calledWithMatch(logStub, 'Total: 0');
});

it('route', async () => {
route.set('test', 'foo');

listRoutes();
sinonAssert.calledWithMatch(logStub, 'Total: 1');
});
});

0 comments on commit e91ef2a

Please sign in to comment.