Skip to content

Commit

Permalink
Merge branch 'AMAN-GUPTA29:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
someswar177 authored May 1, 2024
2 parents 6aaeb0e + 4cd473b commit 078578b
Show file tree
Hide file tree
Showing 19 changed files with 797 additions and 30 deletions.
35 changes: 28 additions & 7 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
name: Unit Tests

on: [pull_request]
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
tests:
runs-on: ubuntu-latest
env:
MY_SALT: ${{ vars.SALT }}
MY_SALT: ${{ secrets.SALT }}
MY_DB: ${{ secrets.DB }}
MY_JWTPRIVATEKEY: ${{ secrets.JWTPRIVATEKEY }}
MY_RAZORPAY_KEY_ID: ${{ secrets.RAZORPAY_KEY_ID }}
MY_RAZORPAY_KEY_SECRET: ${{ secrets.RAZORPAY_KEY_SECRET }}
MY_CLOUDNARY_API_KEY: ${{ secrets.CLOUDNARY_API_KEY }}
MY_CLOUDNARY_API_SECREAT: ${{ secrets.CLOUDNARY_API_SECREAT }}
MY_CLOUDNARY_API_NAME: ${{ secrets.CLOUDNARY_API_NAME }}
strategy:
matrix:
node-version: [18.x]
Expand All @@ -18,10 +31,18 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- name: npm intsall
run: npm ci
- name: env vars
run: echo ${{ vars.SALT }}
run: npm i
- name: Manage .env
run: source cicd.sh
run: |
source cicd.sh
source cicd.sh > ./server/.env
source cicd.sh > ./.env
cat ./server/.env
- name: tests
run: npm test
run: |
cd server
npm i --force
cd ..
pwd
npm test
cat log.txt
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/node_modules
/node_modules
mongoURL.js
.env
10 changes: 9 additions & 1 deletion cicd.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
#!/bin/bash
echo "My SALT is $MY_SALT"
echo "DB=$MY_DB"
echo "JWTPRIVATEKEY=$MY_JWTPRIVATEKEY"
echo "SALT = $MY_SALT"
echo "RAZORPAY_KEY_ID=$MY_RAZORPAY_KEY_ID"
echo "RAZORPAY_KEY_SECRET=$MY_RAZORPAY_KEY_SECRET"

echo "CLOUDNARY_API_KEY=$MY_CLOUDNARY_API_KEY"
echo "CLOUDNARY_API_SECREAT=$MY_CLOUDNARY_API_SECREAT"
echo "CLOUDNARY_API_NAME=$MY_CLOUDNARY_API_NAME"
17 changes: 14 additions & 3 deletions demo.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
const { default: expect } = require("expect")
require('dotenv').config()
const { expect } = require("expect")
const supertest = require('supertest')
const {app} = require('./server/test_server.js')

test('demo testing for sum', () => {
expect(1+2).toBe(3)
})
expect(1 + 2).toBe(3)
})

test('testing get all services', async () => {
const response = await supertest(app).get("/api/customer/viewServices")
expect(response).not.toBe(null)
return
})

// Finalise
35 changes: 35 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// jest.config.js
module.exports = {
roots: ["./"],
collectCoverageFrom: ["./**/*.{js,jsx,ts,tsx}", "!src/**/*.d.ts"],
// setupFilesAfterEnv: ["<rootDir>/setupTests.js"],
testMatch: [
"./**/__tests__/**/*.{js,jsx,ts,tsx}",
"./**/*.{spec,test}.{js,jsx,ts,tsx}",
],
testEnvironment: "node",
transform: {
"^.+\\.(js|jsx|ts|tsx)$": "./node_modules/babel-jest",
},
transformIgnorePatterns: ["[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tsx)$"],
modulePaths: [],
moduleNameMapper: {
"^react-native$": "react-native-web",
"\\.(css|less|scss|sss|styl)$": "./node_modules/jest-css-modules",
},
moduleFileExtensions: [
"web.js",
"js",
"json",
"web.jsx",
"jsx",
"node",
"ts",
"tsx",
],
// watchPlugins: [
// "jest-watch-typeahead/filename",
// "jest-watch-typeahead/testname",
// ],
};

Empty file added log.txt
Empty file.
Loading

0 comments on commit 078578b

Please sign in to comment.