1.0.10 ⢠Published 3 years ago
fran-testing-library v1.0.10
Getting Started
Install fran-testing-library using npm
npm install fran-testing-libraryFran testing library does not need any configuration to start.
Let's start by writing a test for a function that adds two numbers. First, create a sum.js file:
function sum(a, b) {
return a + b;
}
module.exports = sum;Then, create a file named sum.test.js. This will contain our actual test:
const sum = require("./sum");
test("adds 1 + 2 to equal 3", () => {
expect(sum(1, 2)).toBe(3);
});Add the following section to your package.json:
{
"scripts": {
"test": "npx fran"
}
}You can also run npx fran directly
Finally, run npm test or npx fran and fran-testing-library will print this message:
PASS ./sum.test.js
ā adds 1 + 2 to equal 3 (5ms)You just successfully wrote your first test using fran-testing-library!