Skip to content

Commit

Permalink
test(console): improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
D-Sketon committed Jun 1, 2023
1 parent bf41826 commit ef9f2e9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/scripts/console/new.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const moment = require('moment');
const { join } = require('path');
const Promise = require('bluebird');
const { useFakeTimers } = require('sinon');
const { spy } = require('sinon');

describe('new', () => {
const Hexo = require('../../../dist/hexo');
Expand Down Expand Up @@ -39,6 +40,16 @@ describe('new', () => {
return rmdir(hexo.base_dir);
});

it('no args', async () => {
hexo.call = spy();
await n({
_: []
});
hexo.call.calledOnce.should.be.true;
hexo.call.args[0][0].should.eql('help');
hexo.call.args[0][1]._[0].should.eql('new');
});

it('title', async () => {
const date = moment(now);
const path = join(hexo.source_dir, '_posts', 'Hello-World.md');
Expand Down

0 comments on commit ef9f2e9

Please sign in to comment.