Skip to content

Commit 30f3c9d

Browse files
author
jaiprasath.m
committed
PA-11727 added env setup
1 parent 15038f4 commit 30f3c9d

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

.github/workflows/run-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ jobs:
2020
- name: Install dependencies
2121
run: npm install && npm install coveralls --save-dev
2222
- name: Run Tests
23-
run: CLIENT_ID=$PG_CLIENT_ID SECRET_KEY=$PG_CLIENT_SECRET npm test && cd coverage && ls && cd .. && cat coverage/lcov.info | npx coveralls
2423
env:
2524
PG_CLIENT_ID: ${{ secrets.XCLIENTIDSANDBOX }}
2625
PG_CLIENT_SECRET: ${{ secrets.XCLIENTSECRETSANDBOX }}
2726
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
27+
run: CLIENT_ID=$PG_CLIENT_ID SECRET_KEY=$PG_CLIENT_SECRET npm test && cd coverage && ls && cd .. && cat coverage/lcov.info | npx coveralls

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ typings
44
dist
55
coverage
66
package-lock.json
7-
test-results
7+
test-results
8+
.env
9+
.env/

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525
"test": "jest --coverage && coveralls < coverage/lcov.info"
2626
},
2727
"dependencies": {
28+
"@sentry/node": "^7.73.0",
2829
"axios": "1.7.7",
29-
"@sentry/node": "^7.73.0"
30+
"cashfree-pg": "^5.0.3",
31+
"dotenv": "^16.5.0"
3032
},
3133
"devDependencies": {
3234
"@types/chai": "^4.3.10",

tests/ordersV5.test.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
1-
const { Cashfree, CardChannelEnum, AppProviderEnum } = require("cashfree-pg");
1+
require('dotenv').config();
2+
const { Cashfree, CardChannelEnum, AppProviderEnum, CFEnvironment } = require("cashfree-pg");
23
const { test, expect } = require("@jest/globals");
34

45
const cashfree = new Cashfree(
5-
Cashfree.SANDBOX,
6-
process.env.CLIENT_ID,
7-
process.env.SECRET_KEY
6+
CFEnvironment.SANDBOX,
7+
process.env.PG_CLIENT_ID,
8+
process.env.PG_CLIENT_SECRET,
9+
null, null, null, null, null
810
);
911

12+
console.log(cashfree);
13+
console.log("process.env.XClientId :: " + process.env.XClientId);
14+
// console.log("XClientId :: " + XClientId);
15+
console.log("process.env.PG_CLIENT_ID :: " + process.env.PG_CLIENT_ID);
16+
// console.log("PG_CLIENT_ID :: " + PG_CLIENT_ID);
17+
console.log("CLIENT_ID :: " + process.env.CLIENT_ID);
18+
1019
const orderAmount = 1;
1120
const xApiVersion = "2025-01-01";
1221
async function createOrderAndReturnSessionId() {

0 commit comments

Comments
 (0)