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

Improve readability of sinon assertions by using named spies and sinon-chai #7456

Closed
2 of 3 tasks
tomalec opened this issue Jun 18, 2020 · 2 comments · Fixed by ckeditor/ckeditor5-dev#649 or #7524
Closed
2 of 3 tasks
Assignees
Labels
package:dev squad:platform Issue to be handled by the Platform team. type:improvement This issue reports a possible enhancement of an existing feature.

Comments

@tomalec
Copy link
Contributor

tomalec commented Jun 18, 2020

📝 Provide a description of the improvement

At today's daily standup CKE5 team agreed to:

  1. Use sinon-chai, to be able to use expect syntax and custom messages for sinon assertions.
     expect( myMethodSpy ).to.be.calledOnce
  2. Use named spies.
    namedSpy = sinon.spy().named( 'myMethod' );
    expect( myMethodSpy ).to.be.calledOnce // expected ~~spy~~ myMethod to be called once but was called twice

Actions to be taken:

📃 Other details

  • Browser: n/a
  • OS: n/a
  • CKEditor version: master@17d7bd7390
  • Installed CKEditor plugins: n/a

If you'd like to see this improvement implemented, add a 👍 reaction to this post.

@tomalec tomalec added type:improvement This issue reports a possible enhancement of an existing feature. squad:platform Issue to be handled by the Platform team. package:dev labels Jun 18, 2020
@mlewand mlewand modified the milestones: nice-to-have, iteration 34 Jun 22, 2020
pomek added a commit to ckeditor/ckeditor5-dev that referenced this issue Jun 29, 2020
Feature (tests): Added `sinon-chai` to automated tests. Closes ckeditor/ckeditor5#7456
@tomalec tomalec reopened this Jun 29, 2020
@tomalec
Copy link
Contributor Author

tomalec commented Jun 29, 2020

We still need the docs entry, don't we?

@tomalec
Copy link
Contributor Author

tomalec commented Jun 30, 2020

@pomek PR for docs is ready #7524

@tomalec tomalec self-assigned this Jul 1, 2020
pomek added a commit that referenced this issue Jul 1, 2020
Docs: Code style suggests to use `sinon-chai` and named spies. Closes #7456.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:dev squad:platform Issue to be handled by the Platform team. type:improvement This issue reports a possible enhancement of an existing feature.
Projects
None yet
2 participants