Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dummy pull req 2 #25

Merged
merged 17 commits into from
May 1, 2024
Merged
33 changes: 27 additions & 6 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 @@ -19,9 +32,17 @@ jobs:
node-version: ${{ matrix.node-version }}
- name: npm intsall
run: npm ci
- name: env vars
run: echo ${{ vars.SALT }}
- 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"
13 changes: 11 additions & 2 deletions demo.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
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
})
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
Loading