Skip to content

Commit c54fb5c

Browse files
committed
added jest to project with one simple test
1 parent 40e97f1 commit c54fb5c

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

jest.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
2+
module.exports = {
3+
preset: 'ts-jest',
4+
testEnvironment: 'node'
5+
};

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,21 @@
1313
"@types/cors": "^2.8.12",
1414
"@types/express": "^4.17.13",
1515
"@types/http-errors": "^1.8.2",
16+
"@types/jest": "^28.1.5",
1617
"@types/morgan": "^1.9.3",
1718
"@types/node": "^18.0.1",
19+
"jest": "^28.1.3",
1820
"node-fetch": "2",
1921
"nodemon": "^2.0.19",
22+
"ts-jest": "^28.0.6",
2023
"ts-node": "^10.8.2",
2124
"typescript": "^4.7.4"
2225
},
2326
"name": "masked-communications",
2427
"scripts": {
2528
"dev": "nodemon -r dotenv/config index.ts",
26-
"loadtest": "node ./tests/loadtest.js"
29+
"loadtest": "node ./tests/loadtest.js",
30+
"test": "jest"
2731
},
2832
"version": "1.0.0"
2933
}

tests/index.test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
require('dotenv').config();
3+
4+
const {createConversation} = require('../src/utils/createConversation.util');
5+
6+
7+
test("Creates a conversation", ()=>{
8+
return createConversation().then(data=>{
9+
expect(data.sid).toBeDefined();
10+
});
11+
});

0 commit comments

Comments
 (0)