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

Photography app auto test #148

Merged
merged 15 commits into from
Jan 20, 2024
43 changes: 42 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,45 @@ jobs:
- run: npm run build
working-directory: typescript-express-reviews
- run: npm test
working-directory: typescript-express-reviews
working-directory: typescript-express-reviews


test-photograhy:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
node: [16]
os: [ubuntu-20.04]
name: Photography Sample App
steps:
## Set up Stargate
- name: disable and stop mono-xsp4.service
run: |
sudo kill -9 $(sudo lsof -t -i:8084)
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
with:
repository: stargate/stargate-mongoose
path: stargate-mongoose
ref: main
- name: Set up JSON API
run: |
chmod +x bin/start_json_api.sh
bin/start_json_api.sh
working-directory: stargate-mongoose
- name: Wait for services
run: |
while ! nc -z localhost 8181; do sleep 1; done
while ! nc -z localhost 8081; do sleep 1; done
working-directory: stargate-mongoose
## Set up and run reviews sample app tests
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: Setup node
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.1.1
with:
node-version: ${{ matrix.node }}

- run: npm install
working-directory: photography-site-demo.js
- run: npm test
working-directory: photography-site-demo.js
2 changes: 1 addition & 1 deletion photography-site-demo.js/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ IS_ASTRA=
OPENAI_API_KEY=

#Fill the Local JSON API related details only when IS_ASTRA is set to 'false'
#Local JSON API URL for example: http://127.0.0.1:8181/v1/ecommerce_test where 'ecommerce_test' is the keyspace name
#Local JSON API URL for example: http://127.0.0.1:8181/v1/photography where 'photography' is the keyspace name
JSON_API_URL=
#Auth URL for example: http://127.0.0.1:8081/v1/auth
JSON_API_AUTH_URL=
Expand Down
4 changes: 4 additions & 0 deletions photography-site-demo.js/.env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
JSON_API_URL=http://127.0.0.1:8181/v1/photography
JSON_API_AUTH_URL=http://127.0.0.1:8081/v1/auth
JSON_API_AUTH_USERNAME=cassandra
JSON_API_AUTH_PASSWORD=cassandra
14 changes: 14 additions & 0 deletions photography-site-demo.js/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';

module.exports = {
extends: [
'@masteringjs'
],
parserOptions: {
ecmaVersion: 2020
},
env: {
node: true,
es6: true
}
};
1 change: 0 additions & 1 deletion photography-site-demo.js/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ typings/

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache
Expand Down
3 changes: 2 additions & 1 deletion photography-site-demo.js/app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
//use nodemon to start app.js in package.json
const express = require('express');
const expressLayouts = require('express-ejs-layouts');
Expand Down Expand Up @@ -29,7 +30,7 @@ app.use(fileUpload());
app.set('layout', './layouts/main');
app.set('view engine', 'ejs');

const routes = require('./server/routes/photoRoutes.js')
const routes = require('./server/routes/photoRoutes.js');
app.use('/', routes);
const cors = require('cors');
app.use(cors());
Expand Down
3 changes: 2 additions & 1 deletion photography-site-demo.js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "demo app for stargate-mongoose",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "mocha tests/*.test.js",
"seed": "env NODE_ENV=development node ./server/models/seed",
"start": "nodemon app.js"
},
Expand All @@ -24,6 +24,7 @@
"express-session": "^1.17.2",
"mongoose": "^8.0.3",
"python-shell": "^5.0.0",
"mocha": "10.2.0",
"stargate-mongoose": "0.4.2"

},
Expand Down
Loading
Loading