Unit Testing Your Application
// tests/unit-tests/app/routers/rental.js
const { request } = require ('@onehilltech/blueprint-testing');
const { expect } = require ('chai');
describe ('app | routers | rental', function () {
context ('GET', function () {
it ('should get all the rentals', async function () {
// Send a mock request to the api, and wait for the response.
const res = await request ()
.post ('/api/rentals')
.expect (200);
// res.body has the text from the response.
// From here you can use chai to implement test oracle via assertions.
});
});
});Last updated