What is the difference between 'it' and 'test' in Jest?
Create a study schedule and stick to it. Allocate time for reading, writing, listening, speaking, and problem-solving exercises every day. #生活技巧# #英语学习#
They do the same thing, but their names are different and with that their interaction with the name of the test.
test
What you write:
describe('yourModule', () => { test('if it does this thing', () => {}); test('if it does the other thing', () => {}); });
What you get if something fails:
yourModule > if it does this thing
it
What you write:
describe('yourModule', () => { it('should do this thing', () => {}); it('should do the other thing', () => {}); });
What you get if something fails:
yourModule > should do this thing
So it's about readability not about functionality.
In my opinion, it really has a point when it comes to read the result of a failing test that you haven't written yourself. It helps to faster understand what the test is about.
Some developer also shorten the Should do this thing to Does this thing which is a bit shorter and also fits semantically to the it notation.
网址:What is the difference between 'it' and 'test' in Jest? https://klqsh.com/news/view/319759
相关内容
What Is The Difference Between Bell MTS And Bell MobilityWhat is the difference between each type of membership?
What is the difference between using Archive in New Outlook and simply putting things in a folder?
Grammar: The Difference between Effect vs. Affect
What is 0.00001 as power of ten?
Affect vs. Effect – What’s the Difference?
What is Wish.com and is it safe to buy from?
Clean Living: what is it?
What Time Is It in Central Time – Live Clock & Current Hour
Pizza Cornicione – What It Is and How to Make It

