Skip to content

Commit

Permalink
test: percent-encoded slug
Browse files Browse the repository at this point in the history
  • Loading branch information
curbengh committed Jul 3, 2020
1 parent 895d76d commit 9d86342
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,20 @@ describe('migrator', function() {
await unlink(path);
});

// #12
it('decode percent-encoding in slug', async () => {
const { unescape } = require('querystring');
const path = join(__dirname, 'fixtures/wordpress.xml');
await m({ _: [path] });

const input = await readFile(path);
const { items } = await parseFeed(input);
const percentEncoded = items.filter(({ slug }) => slug.includes('%'))[0];
const posts = await listDir(join(hexo.source_dir, '_posts'));

posts.includes(unescape(percentEncoded.slug) + '.md').should.eql(true);
});

it('no argument', async () => {
try {
await m({ _: [''] });
Expand Down

0 comments on commit 9d86342

Please sign in to comment.