forked from hopetambala/puente-node-cloudcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from hopetambala/master
Merge main into open-source main
- Loading branch information
Showing
30 changed files
with
4,896 additions
and
3,639 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
PARSE_SERVER_ALLOW_ORIGIN="*" | ||
PARSE_ENV=dev | ||
PARSE_APP_ID="myAppId" | ||
PARSE_JAVASCRIPT_KEY=_PLACEHOLDER_ | ||
PARSE_SERVER_URL="http://localhost:1337/parse" | ||
PARSE_SERVER_URL="http://localhost:1337/parse" | ||
PUENTE_SMS_EMAIL_API_URL=http://puentes-messaging-microservice.com | ||
PUENTE_MANAGE_URL=https://sample-puente-manage.app/" | ||
|
||
SLACK_TOKEN="" | ||
SLACK_DEV_CHANNEL="" | ||
SLACK_PROD_CHANNEL="" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,53 @@ | ||
name: Jest Tests | ||
|
||
env: | ||
PARSE_ENV : "dev" | ||
PARSE_APP_ID : "myAppId" | ||
PARSE_JAVASCRIPT_KEY : "_PLACEHOLDER_" | ||
PARSE_SERVER_URL : "http://localhost:1337/parse" | ||
PARSE_ENV: "dev" | ||
PARSE_APP_ID: "myAppId" | ||
PARSE_JAVASCRIPT_KEY: "_PLACEHOLDER_" | ||
PARSE_SERVER_URL: "http://localhost:1337/parse" | ||
PUENTE_ENV: "dev" | ||
PUENTE_SMS_EMAIL_API_URL: "http://puentes-messaging-microservice.com" | ||
PUENTE_MANAGE_URL: "https://sample-puente-manage.app/" | ||
SLACK_TOKEN: "" | ||
SLACK_DEV_CHANNEL: "" | ||
SLACK_PROD_CHANNEL: "" | ||
|
||
on: | ||
push: | ||
branches: | ||
branches: | ||
- master | ||
- dev | ||
pull_request: | ||
branches: | ||
- master | ||
- dev | ||
branches: | ||
- master | ||
- dev | ||
jobs: | ||
jest-testing: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [12.x,14.x] | ||
node-version: [14.x, 16.x] | ||
services: | ||
mongodb: | ||
image: mongo:4.4 | ||
ports: | ||
- 27017:27017 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Install Puente CloudCode Dependencies | ||
run: | | ||
npm install | ||
- name: Lint | ||
run: | | ||
npm run lint | ||
- name: Start App and Test Jest | ||
run: | | ||
npm run start & | ||
sleep 40 && | ||
npm run test-github-actions | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Install Puente CloudCode Dependencies | ||
run: | | ||
npm install | ||
- name: Lint | ||
run: | | ||
npm run lint | ||
- name: Start App and Test Jest | ||
run: | | ||
npm run start & | ||
sleep 40 && | ||
npm run test-github-actions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,6 @@ logs | |
*.DS_Store | ||
/coverage | ||
.parse.local | ||
.env.staging | ||
.env.prod | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v14.20.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ describe('role testing', () => { | |
let db; | ||
let adminRoleID; | ||
let contribRoleID; | ||
let rollingUserObject; | ||
|
||
beforeAll(async () => { | ||
connection = await MongoClient.connect(process.env.MONGO_URL, { | ||
|
@@ -22,6 +23,9 @@ describe('role testing', () => { | |
password: 'dracarys', | ||
email: '[email protected]', | ||
organization: 'got', | ||
restParams: { | ||
runMessaging: false, | ||
}, | ||
}; | ||
return cloudFunctions.signup(credentials).then((result) => { | ||
const jsonString = JSON.stringify(result); | ||
|
@@ -59,6 +63,10 @@ describe('role testing', () => { | |
email: '[email protected]', | ||
organization: 'got', | ||
phonenumber: 1234567890, | ||
restParams: { | ||
runMessaging: false, | ||
path: 'email', | ||
}, | ||
}; | ||
return cloudFunctions.signup(credentials).then((result) => { | ||
const jsonString = JSON.stringify(result); | ||
|
@@ -106,6 +114,7 @@ describe('role testing', () => { | |
return cloudFunctions.signin(credentials).then((result) => { | ||
const jsonString = JSON.stringify(result); | ||
const jsonValues = JSON.parse(jsonString); | ||
rollingUserObject = jsonValues; | ||
|
||
expect(jsonValues.firstname).toEqual('Jon'); | ||
expect(jsonValues.lastname).toEqual('Snow'); | ||
|
@@ -118,6 +127,32 @@ describe('role testing', () => { | |
}); | ||
}); | ||
|
||
it('should update the user', async () => { | ||
const originalUserObject = rollingUserObject; | ||
|
||
const params = { | ||
objectId: originalUserObject.objectId, | ||
userObject: { | ||
firstname: 'Ron', | ||
lastname: 'Flow', | ||
}, | ||
}; | ||
|
||
return cloudFunctions.updateUser(params).then((result) => { | ||
const jsonString = JSON.stringify(result); | ||
const jsonValues = JSON.parse(jsonString); | ||
|
||
expect(jsonValues.firstname).toEqual('Ron'); | ||
expect(jsonValues.lastname).toEqual('Flow'); | ||
expect(jsonValues.username).toEqual('1234567890'); | ||
expect(jsonValues.email).toEqual('[email protected]'); | ||
expect(jsonValues.organization).toEqual('got'); | ||
expect(jsonValues.role).toEqual('contributor'); | ||
expect(jsonValues.adminVerified).toEqual(false); | ||
expect(jsonValues.objectId).toEqual(contribRoleID); | ||
}); | ||
}); | ||
|
||
it('should delete all users', async () => { | ||
const removeParams = [ | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const { MongoClient } = require('mongodb'); | ||
const { cloudFunctions } = require('../run-cloud'); | ||
|
||
describe('crud testing', () => { | ||
let connection; | ||
let db; | ||
|
||
beforeAll(async () => { | ||
connection = await MongoClient.connect(process.env.MONGO_URL, { | ||
useNewUrlParser: true, | ||
useUnifiedTopology: true, | ||
}); | ||
db = await connection.db(); | ||
}); | ||
|
||
afterAll(async () => { | ||
await connection.close(); | ||
await db.close(); | ||
}); | ||
|
||
it('Test error response in SurveyData post when empy params', async () => { | ||
const postParams = { | ||
}; | ||
return cloudFunctions.postObjectsToClass(postParams).then((result) => { | ||
const err = 'Error: no request params'; | ||
expect(result).toEqual(err); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,6 +70,10 @@ describe('role testing', () => { | |
password: 'leia', | ||
email: '[email protected]', | ||
organization: 'star-wars', | ||
restParams: { | ||
runMessaging: false, | ||
path: 'email', | ||
}, | ||
}; | ||
return cloudFunctions.signup(credentials).then((result) => { | ||
const jsonString = JSON.stringify(result); | ||
|
@@ -94,6 +98,10 @@ describe('role testing', () => { | |
email: '[email protected]', | ||
organization: 'star-wars', | ||
phonenumber: '1234567373', | ||
restParams: { | ||
runMessaging: false, | ||
path: 'email', | ||
}, | ||
}; | ||
return cloudFunctions.signup(credentials).then((result) => { | ||
const jsonString = JSON.stringify(result); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"dependencies": { | ||
"@slack/web-api": "^6.8.0", | ||
"axios": "^0.27.2", | ||
"lodash": "^4.17.19" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.