https://github.com/ardier16/jsunit
A simple unit testing framework written in JavaScript (ES6)
https://github.com/ardier16/jsunit
css3 es6 html5 javascript javascript-library testing-framework unit-testing vanilla-js
Last synced: 7 months ago
JSON representation
A simple unit testing framework written in JavaScript (ES6)
- Host: GitHub
- URL: https://github.com/ardier16/jsunit
- Owner: ardier16
- License: gpl-3.0
- Created: 2018-11-20T10:51:12.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-05T19:35:41.000Z (over 6 years ago)
- Last Synced: 2025-01-23T08:43:53.730Z (9 months ago)
- Topics: css3, es6, html5, javascript, javascript-library, testing-framework, unit-testing, vanilla-js
- Language: JavaScript
- Size: 18.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JS Unit
A simple unit testing framework written in JavaScript (ES6).## Using
```js
JSUnit.beforeEach(index => {
console.log("Start test #" + index);
});JSUnit.afterEach(index => {
console.log("Finish test #" + index);
});JSUnit.module("NaN")
JSUnit.test("IsNaN Function", assert => {
assert.isTrue(isNaN(NaN), "NaN parameter");
assert.isFalse(isNaN(Infinity), "Infinity is not NaN");
});JSUnit.module("Sum");
JSUnit.test("Sum Function", assert => {
assert.equal(sum(4, 5), 9, "Simple add");
assert.equal(sum("5", 8), 13, "One string parameter");
assert.equal(sum(), 0, "No arguments");
});JSUnit.module("Power");
JSUnit.test("Power function", assert => {
assert.equal(pow(2, 3), 8, "2**3 = 8");
assert.equal(pow(3, 4), 81, "3**4 = 81");
assert.isNaN(pow(2, -1), "NaN for negative exponents");
});
```