-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added unit test framework and unit test github action
- Loading branch information
1 parent
d74ad2d
commit a7ab985
Showing
5 changed files
with
67 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Test App - Node.js | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'app/**' | ||
pull_request: | ||
paths: | ||
- 'app/**' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test-app: | ||
name: 'Test Node.js App' | ||
runs-on: ubuntu-latest | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
working-directory: 'app' | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
|
||
- name: NPM Install | ||
run: npm install | ||
|
||
- name: NPM Test | ||
run: npm test |
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 |
---|---|---|
@@ -1,10 +1,16 @@ | ||
{ | ||
"dependencies": { | ||
"@azure/openai": "^1.0.0-beta.11", | ||
"chai": "^4.4.1", | ||
"chai-http": "^4.4.0", | ||
"cors": "^2.8.5", | ||
"dotenv": "^16.4.5", | ||
"express": "^4.18.3", | ||
"mocha": "^10.3.0", | ||
"swagger-jsdoc": "^6.2.8", | ||
"swagger-ui-express": "^5.0.0" | ||
}, | ||
"scripts": { | ||
"test": "mocha test/*.js --exit" | ||
} | ||
} |
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,18 @@ | ||
const chai = require('chai'), | ||
expect = chai.expect, | ||
chaiHttp = require('chai-http') | ||
|
||
chai.use(chaiHttp) | ||
|
||
const app = require('../app.js') | ||
|
||
describe('AIChatUI Web App', function() { | ||
it('should respond with a 200 status code', function(done) { | ||
chai.request(app) | ||
.get('/') | ||
.end(function(err, res) { | ||
expect(res).to.have.status(200); | ||
done(); | ||
}); | ||
}); | ||
}); |
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,8 @@ | ||
const assert = require('assert') | ||
describe('Array', function () { | ||
describe('#indexOf()', function () { | ||
it('should return -1 when the value is not present', function () { | ||
assert.equal([1, 2, 3].indexOf(4), -1); | ||
}); | ||
}); | ||
}); |