-
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 branch main into APP-67-Flight-Request-Endpoint
- Loading branch information
Showing
13 changed files
with
157 additions
and
25 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
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,3 +1,4 @@ | ||
node_modules/ | ||
.env | ||
build/ | ||
build/ | ||
.nyc_output/ |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
.nyc_output/processinfo/6ef9d3c5-9edd-4152-a8c1-360cb9258935.json
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
.nyc_output/processinfo/d17279ea-2c6c-4bc8-bf91-e1388e3c7c6e.json
This file was deleted.
Oops, something went wrong.
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
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
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,76 @@ | ||
import { configureServer } from '../config/server.config'; | ||
import chaiHttp from 'chai-http'; | ||
import dotenv from 'dotenv'; | ||
import chai, { expect } from 'chai'; | ||
import type { Server } from 'http'; | ||
dotenv.config(); | ||
|
||
// set up chai | ||
chai.use(chaiHttp); | ||
chai.should(); | ||
|
||
// set up mock server | ||
const app = configureServer(); | ||
let server: Server; | ||
|
||
// start mock server | ||
before(done => { | ||
server = app.listen(3483, () => { | ||
done(); | ||
}); | ||
}); | ||
|
||
// close mock server | ||
after(done => { | ||
server.close(); | ||
done(); | ||
}); | ||
|
||
// describe is group of tests | ||
// it is the actual test itself | ||
// Test case | ||
describe('GET /passenger', () => { | ||
it('should return a 400 response', done => { | ||
chai | ||
.request(app) | ||
.get('/passenger') | ||
.query({ id: '' }) | ||
.end((err, res) => { | ||
expect(res).to.have.status(400); | ||
done(); | ||
}); | ||
}); | ||
it('should be an accompanying passenger', done => { | ||
chai | ||
.request(app) | ||
.get('/passenger') | ||
.query({ id: 'recleNlsBm3dheZHy' }) | ||
.end((err, res) => { | ||
expect(res.body[0]['First Name']).to.be.oneOf(['Anakin', 'Bail']); | ||
expect(res).to.have.status(200); | ||
done(); | ||
}); | ||
}); | ||
it('should be an accompanying passenger', done => { | ||
chai | ||
.request(app) | ||
.get('/passenger') | ||
.query({ id: 'recleNlsBm3dheZHy' }) | ||
.end((err, res) => { | ||
expect(res.body[1]['Gender']).to.equal('Male'); | ||
expect(res).to.have.status(200); | ||
done(); | ||
}); | ||
}); | ||
it('should be an accompanying passenger', done => { | ||
chai | ||
.request(app) | ||
.get('/passenger') | ||
.query({ id: 'recleNlsBm3dheZHy' }) | ||
.end((err, res) => { | ||
expect(res.body[2]['Relationship']).to.be.oneOf(['Father', undefined]); | ||
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