0.2.9 • Published 6 months ago
theframework-tester v0.2.9
The Framework - Tester
This package makes it easy to test your applications built with The Framework.
How to use
First, install it:
npm install --save theframework-tester
Next, create a file in your project that you'll run your tests from, e.g. test/test.js.
In that file, do something like:
const theFramework = require("the-framework");
const testRunner = require("../test-runner");
// Setup your server as you would normally (i.e. from your main app)
const server = theFramework.startServer({
test: true,
apiDirectory: "test/api"
});
// Run whichever tests you want
async function run () {
const testResult = await testRunner.runTest(
server, // The server you are running against
"Test Hello Works", // Description of the purpose of your test
"GET", // HTTP Method
"/hello?name=Daryl", // URL
200, // HTTP Status you are expecting
{
message: "Hello Daryl"
} // Object or parts of object you are expecting back
);
// You can also manually fail tests if you want to run your own checks
// In this case, pass the test object and then a description of why it didn't work
testRunner.failTest(test1, "Did not work");
// After you've run all your tests, call summarise to summarise the results
testRunner.summarise();
}
run();
0.2.9
6 months ago
0.2.8
6 months ago
0.2.1
7 months ago
0.2.0
7 months ago
0.2.7
7 months ago
0.2.6
7 months ago
0.2.3
7 months ago
0.2.2
7 months ago
0.2.5
7 months ago
0.2.4
7 months ago
0.1.8
10 months ago
0.1.7
10 months ago
0.1.9
10 months ago
0.1.6
10 months ago
0.1.5
4 years ago
0.1.4
4 years ago
0.1.3
4 years ago
0.1.2
4 years ago
0.1.0
4 years ago