Structuring Tests - Deepstash

Structuring Tests

Jest offers describe function to help structure your tests. Use describe to group together all tests that belong to one functionality. Describes can be nested, if you need that. Other functions you'll commonly use are beforeEach or beforeAll that you can use for setting up the objects you're testing.

If your test has many steps or many expectations, you probably want to split it into multiple smaller ones. Also, ensure that your tests are completely independent of one another. Each test in your suite must be executable on its own without first running some other test.

16

20 reads

CURATED FROM

IDEAS CURATED BY

The idea is part of this collection:

Machine Learning With Google

Learn more about computerscience with this collection

Understanding machine learning models

Improving data analysis and decision-making

How Google uses logic in machine learning

Related collections

Similar ideas to Structuring Tests

Structuring Tests

Structuring Tests

Your tests should be short and ideally test only one thing.

The test in the image is described by the string passed to the it function. Take good care writing the description so that it’s clear what is being tested...

Some neuroscience terms defined

Some neuroscience terms defined

The brain operates in a complex way with many parts intersecting and interacting with each other simultaneously. So, when you have that thought in the morning, it's likely that all these different component of your brain (prefrontal cortex, hippocampus, neurons, neurotransmitters, etc.) are all i...

How to study 📚🦋💻📑

Get organized

  1. Carry a homework planner at all times. Entering homework, projects, tests and assignments as soon as they are assigned will make sure they aren’t forgotten about.

Pay attention in class

  1. It’s important to concentrate and avoid distractions when t...

Read & Learn

20x Faster

without
deepstash

with
deepstash

with

deepstash

Personalized microlearning

100+ Learning Journeys

Access to 200,000+ ideas

Access to the mobile app

Unlimited idea saving

Unlimited history

Unlimited listening to ideas

Downloading & offline access

Supercharge your mind with one idea per day

Enter your email and spend 1 minute every day to learn something new.

Email

I agree to receive email updates