Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

post_link should throw error if no slug/post found #4426

Merged
merged 2 commits into from
Jul 18, 2020
Merged

post_link should throw error if no slug/post found #4426

merged 2 commits into from
Jul 18, 2020

Conversation

stevenjoezhang
Copy link
Member

What does it do?

Issue resolved: #1594

How to test

git clone -b post_link https://github.com/hexojs/hexo.git
cd hexo
npm install
npm test

Screenshots

Pull request tasks

  • Add test cases for the changes.
  • Passed the CI test.

@coveralls
Copy link

coveralls commented Jul 18, 2020

Coverage Status

Coverage increased (+0.0005%) to 98.238% when pulling b8b9d4a on post_link into 064daa4 on master.

});

it('post not found', () => {
should.not.exist(postLink(['bar']));
postLink(['bar']).should.eql('<a href="#">Post not found: Invalid post_link</a>');
Copy link
Member

@SukkaW SukkaW Jul 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    const error = `<a href="#">Post not found: ${args.join(' ') || 'Invalid post_link'}</a>`;

Add a test case for args.join(' ')?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test case updated

@SukkaW SukkaW merged commit 97cb698 into master Jul 18, 2020
@stevenjoezhang stevenjoezhang deleted the post_link branch July 18, 2020 07:34
@SukkaW SukkaW mentioned this pull request Jul 25, 2020
22 tasks
@xbc5 xbc5 mentioned this pull request Apr 9, 2022
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

post_link should throw error if no slug/post found
3 participants