Transcript from the "Your First Test Exercise" Lesson
[00:00:18] So if you can open up your projects. Open up your terminal and the project and your editor. We're gonna start in this other directory and what's a test? And that you'll start in one.todo.js. And in here there are some comments to explain what you're supposed to do. But the idea with all of these is that you're going to write a framework, and then you'll write an assertion library.
[00:00:51] But this first one, we're going to write the simplest form of a test that you could possibly imagine.
>> Kent C. Dodds: And so to run this, you're gonna want to change your directory into this where we are right now so you'll cd into other what's a test? And then for each one of these it will say and then run this code with and then command so for us it's node1.todo.
[00:01:22] And you'll know that you got it right when your when running that actually throws a bug, or it throws an error because there is a bug. Who found the bug? Yeah, Peter found it, what is it?
>> Speaker 2: Sum is actually subtracting and sum-
>> Kent C. Dodds: Yeah. Yeah, so that's intentional because a huge part of testing frameworks job is to, show you now the errors and you get error messages so you can both know what's wrong and also know how to fix it.
[00:01:55] And so, yeah so sum is intentionally broken in this way. So, what your job is to write additional code, presumably after this code to throw a useful error to validate whether sum is working or not. So you use sum and then you validate that it is returning what it should be, an d if it's not, then you throw an error.