Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/erikyo/eli5tests


https://github.com/erikyo/eli5tests

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

        

# Explain Like I'm 5 Tests

Hey there little buddy! 👋 Welcome to the "Explain Like I'm 5 Tests" repository, where we're going to have some fun understanding how tests work, just like playing with your favorite toys!

## What's Inside?

### Animal Kingdom 🐾

Imagine we have a magical world called the "Animal Kingdom," where there are animals of all shapes and sizes. We created a special class called `Animal` that helps us describe these creatures.

```javascript
class Animal {
// ... (some code magic)
}
```

These animals have names, colors, and even emojis! 🦄

### Dogs 🐶

Now, let's talk about dogs – those furry friends who go "woof woof" or "yip yip"! We've got a class called `Dog` that tells us all about them.

```javascript
class Dog extends Animal {
// ... (more code magic)
}
```

Dogs can bark, and depending on their size, they either go "Woof woof!" if they're big or "Yip yip!" if they're small. Don't forget their emojis – they're like little badges of honor! 🏅

### Cats 🐱

Next up, we have cool cats! 🐱 The `Cat` class is in charge of our feline friends.

```javascript
class Cat extends Animal {
// ... (even more code magic)
}
```

Cats meow and purr, and they have their own emojis too! 🐱

## Let's Play with Tests! 🎉

Now, we've got some tests to make sure our Animal Kingdom is working as expected. Imagine tests are like little detectives checking if everything is in order.

### Naming and Coloring 🌈

We check if our animals have names and colors, and even make sure they use the right emojis! We want everything to be just perfect.

### Dog Barks 🐕

For our dogs, we test if they bark correctly. Big dogs go "Woof woof!" and small dogs go "Yip yip!" We also check if they proudly wear their doggy emojis. 🐶

### Cat Meows and Purrs 😸

Our cats are special too! We test if they meow, purr, and show off their cute cat emojis. 🐱

## How to Play with Tests

To join the fun and play with our tests, we need a special tool called Jest. But first, we need to make sure we have Node.js installed. 🧙‍♂️

### Checking if Node.js is in Your Toy Box

Do a quick check if Node.js is in your toy box. Open the command line and type:

```bash
npm -v
```

If it's not there, don't worry! Mommy or daddy can go to the Node.js website (https://nodejs.org/) and bring it home for you. 🏡

## Let's Play with the Magical Wizard (Command Line) 🧙‍♂️

Alright, little explorer! 🕵️ Now, let me show you how to summon the magical wizard to make our Animal Kingdom tests come to life. It's like casting a spell!

### Step 1: Get Your Magic Wand (Install Jest)

Open your command line – it's like a secret portal to the wizard world. Type this funny incantation and press Enter:

```bash
npm install
```

Wait for the wizard to gather all the enchanted tools. 🪄

### Step 2: Unleash the Wizard (Run Tests)

Now, it's time to let the wizard do its thing. Type the following command and watch the magic unfold:

```bash
npm run tests
```

The wizard will start chanting, and you'll see if our Animal Kingdom is all smiles and laughter. 🎉

### Bonus: Check the Magic Scroll (Package.json)

If you're curious about the wizard's spells, peek into the magical scroll called `package.json`. Look for the section with "scripts," and you'll find the spell for running tests.

```json
"scripts": {
"tests": "jest"
}
```

See? The wizard has its spells neatly written down!

## Let's Wrap It Up!

And there you have it, kiddo! 🌟 That's how we make sure our Animal Kingdom is happy and playful. Just like you, we want everything to be perfect and full of joy!

Now, go ahead and explore this magical world of tests. If you ever have questions, just ask – we're here to play and learn together! 🚀