Skip to content

Add Sinon to do better unit test - #25820

Merged
Johann-S merged 1 commit into
v4-devfrom
v4-johann-sinon
Mar 13, 2018
Merged

Johann-S merged 1 commit into
v4-devfrom
v4-johann-sinon

Conversation

@Johann-S

@Johann-S Johann-S commented Mar 9, 2018

Copy link
Copy Markdown
Member

Comment thread js/tests/karma.conf.js Outdated
// list of files / patterns to load in the browser
files: [
jqueryFile,
'js/tests/vendor/sinon.min.js',

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Maybe should I add karma-sinon instead of adding this file 🤔

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we can achieve the same without the manually copied dependency, then go for it 👍

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We'll still need the local file to run our unit test without Karma

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Your call. I'm not very familiar with the karma config.

Also, I don't quite get this whole change, care to elaborate a bit?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sure 😃 QUnit possess just a few methods compare to newer Framework of unit testing (Karma, Mocha), they are a lot of new concepts (Mocks, Spies, Stubs) which provide a better way to test our methods, because for example you can be sure a method have been called, or fake user data, or change temporary the behavior of our methods.

See : http://sinonjs.org/#try-it-out

@twbs twbs deleted a comment from AshikurRahman-Peters Mar 12, 2018

@XhmikosR XhmikosR left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good as far as I can review this.

@Johann-S
Johann-S merged commit 4d5c592 into v4-dev Mar 13, 2018
@Johann-S
Johann-S deleted the v4-johann-sinon branch March 13, 2018 14:37
@mdo mdo mentioned this pull request Mar 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants