Skip to content

Commit

Permalink
add mocha test
Browse files Browse the repository at this point in the history
  • Loading branch information
mskian committed Mar 1, 2024
1 parent 47b78f6 commit 3589f4a
Show file tree
Hide file tree
Showing 6 changed files with 449 additions and 9 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: connect-test

on:
pull_request:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
node-version: '18.x'
- name: use yarn and Test the App
run: |
yarn install
yarn ci
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Alexa Cricket Score

![connect-test](https://github.com/sanwebinfo/alexa-score/workflows/connect-test/badge.svg)

A Simple Static Site With WebSocket for Getting Real-time Live Cricket Score Updates.

> Get live Cricket Score Update by reloading the web page using Websocket and Alexa.
Expand Down
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,5 @@ app.use((err, req, res, next) => {
server.listen(port, () => {
console.log('listening on port ' + port);
});

module.exports = app;
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"scripts": {
"test": "node test.js",
"start": "node index.js",
"dev": "nodemon index.js --ext '*'"
"dev": "nodemon index.js --ext '*'",
"ci": "mocha ./test/* --exit"
},
"keywords": [
"alexa",
Expand All @@ -33,6 +34,8 @@
"ws": "^8.16.0"
},
"devDependencies": {
"nodemon": "^3.0.3"
"mocha": "^10.3.0",
"nodemon": "^3.0.3",
"supertest": "^6.3.4"
}
}
8 changes: 8 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const request = require("supertest");
const app = require("../index");

describe("GET /", () => {
it("responds 200", (done) => {
request(app).get("/").expect(200, done);
})
});
Loading

0 comments on commit 3589f4a

Please sign in to comment.