<commit_before>'use strict';

const sinon = require('sinon');

describe('migrate', () => {
  const Hexo = require('../../../lib/hexo');
  const hexo = new Hexo(__dirname, {silent: true});
  const migrate = require('../../../lib/plugins/console/migrate').bind(hexo);

  it('default', () => {
    const migrator = sinon.spy(args => {
      args.foo.should.eql(1);
      args.bar.should.eql(2);
    });

    hexo.extend.migrator.register('test', migrator);

    return migrate({_: ['test'], foo: 1, bar: 2}).then(() => {
      migrator.calledOnce.should.be.true;
    });
  });
});<commit_msg>refactor(test-console-migrate): async/await & destructure (#3961)<commit_after>'use strict';

const { spy } = require('sinon');

describe('migrate', () => {
  const Hexo = require('../../../lib/hexo');
  const hexo = new Hexo(__dirname, {silent: true});
  const migrate = require('../../../lib/plugins/console/migrate').bind(hexo);

  it('default', async () => {
    const migrator = spy(args => {
      args.foo.should.eql(1);
      args.bar.should.eql(2);
    });

    hexo.extend.migrator.register('test', migrator);

    await migrate({_: ['test'], foo: 1, bar: 2});
    migrator.calledOnce.should.eql(true);
  });
});
{'fraction_non_alphanumeric': 0.2320396366639141, 'fraction_numerical': 0.00990916597853014, 'mean_word_length': 3.2526315789473683, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4988603', 'n_tokens_mistral': 439, 'n_tokens_neox': 423, 'n_words': 72}