litetest v1.0.7
LiteTest
LiteTest is a lightweight testing library for JavaScript. With LiteTest, you can write tests for your JavaScript code and ensure that it works as expected.
Installation
To use LiteTest in your project, you'll need to install it using npm. You can do this by running the following command:
npm install litetest
Usage
LiteTest provides two methods for making assertions in your tests: assert
and assertn
.
assert(value_, assert_, errMsg_)
The assert
method is used to test whether a value is equal to an expected value. It takes three parameters:
value_
- the actual value to testassert_
- the expected valueerrMsg_
- an error message to display if the assertion fails
Here's an example of how to use assert
:
const litetest = require('litetest');
litetest.assert(value_, 4, 'value_ should equal 4');
assertn(value, assertn, errMsg_)
The assertn method is used to test whether a value is not equal to an expected value. It takes three parameters:
value_
- the actual value to testassertn_
- the expected valueerrMsg_
- an error message to display if the assertion fails
Here's an example of how to use assertn
:
const litetest = require('litetest');
litetest.assertn(value_, 5, 'value_ should not equal 5');
agree(value_, assert_)
The agree
function is used to test whether a value is equal to an expected value. It takes two parameters:
value_
- the actual value to testassert_
- the expected value
The function returns a boolean value indicating whether the test passed or failed.
Here's an example of how to use agree
:
const litetest = require('litetest');
// Test if 2 + 2 equals 4
litetest.agree(2 + 2, 4); // Returns true
// Test if a variable is equal to a string
const myString = 'hello';
litetest.agree(myString, 'hello'); // Returns true
Contributing
We welcome contributions from the community! If you find a bug or have a suggestion for how to improve LiteTest, please open an issue or submit a pull request on GitHub.