2.1.1 • Published 1 year ago
@apolitical/testing v2.1.1
Apolitical Testing
Node.js module to encapsulate Jest testing helpers (backend)
Requirements
Requires the following to run:
Installation
Install with yarn
:
yarn add -D @apolitical/testing
Usage
First of all, include @apolitical/testing
module:
const apoliticalTesting = require('@apolitical/testing');
Request
The recommended way to use request helper is first by creating an instance with the session secret to encode the JWT tokens:
const instance = apoliticalTesting.request({ sessionSecret: 'hello' });
Then, you can use your express app to generate supertests agents:
const agents = instance.generateAgents(app);
The agents are:
loggedIn
loggedOut
loggedInAdmin
loggedInMyself
The loggedInMyself
agent can also be updated with custome token payload with the use of the assignTokenToMyself
function.
2.1.0-rc.1
1 year ago
2.1.1
1 year ago
2.1.0
1 year ago
2.0.0
1 year ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago
1.0.0-beta.0
2 years ago
0.0.3
3 years ago
0.0.3-beta.0
3 years ago
0.0.4
3 years ago
0.0.2
3 years ago
0.0.1
3 years ago