Add routing, state mgmt and train types

This commit is contained in:
Conor McNamara
2023-03-04 17:02:06 +00:00
parent b0b5ecd36a
commit 8af615a429
12 changed files with 606 additions and 89 deletions

View File

@ -6,7 +6,7 @@ const expect = chai.expect;
describe('Firebase cloud function tests', function() {
this.timeout(100000);
it('Test getting live train data', async() => {
it('Test getting live train data from the database', async() => {
const result = await chai.request('https://us-central1-irishrailtracker.cloudfunctions.net')
.get('/getLiveTrainData')
expect(result.statusCode).to.equal(200);
@ -18,6 +18,20 @@ describe('Firebase cloud function tests', function() {
expect(result.body.data[0]).haveOwnProperty('TrainLongitude');
expect(result.body.data[0]).haveOwnProperty('TrainCode');
expect(result.body.data[0]).haveOwnProperty('TrainDate');
expect(result.body.data[0]).haveOwnProperty('TrainType');
}),
this.timeout(100000);
it('Test getting station data from the database', async() => {
const result = await chai.request('https://us-central1-irishrailtracker.cloudfunctions.net')
.get('/getStationData')
expect(result.statusCode).to.equal(200);
expect(result.body.data).to.be.an('Array');
expect(result.body.data[0]).haveOwnProperty('StationDesc');
expect(result.body.data[0]).haveOwnProperty('StationLatitude');
expect(result.body.data[0]).haveOwnProperty('StationLongitude');
expect(result.body.data[0]).haveOwnProperty('StationCode');
expect(result.body.data[0]).haveOwnProperty('StationId');
}),
this.timeout(100000);
@ -27,19 +41,6 @@ describe('Firebase cloud function tests', function() {
expect(result.statusCode).to.equal(200);
}),
this.timeout(100000);
it('test getting station data', async() => {
const result = await chai.request('https://us-central1-irishrailtracker.cloudfunctions.net')
.get('/getStationData')
expect(result.statusCode).to.equal(200);
expect(result.body.data).to.be.an('Array');
expect(result.body.data[0]).haveOwnProperty('StationDesc');
expect(result.body.data[0]).haveOwnProperty('StationLatitude');
expect(result.body.data[0]).haveOwnProperty('StationLongitude');
expect(result.body.data[0]).haveOwnProperty('StationCode');
expect(result.body.data[0]).haveOwnProperty('StationId');
})
this.timeout(100000);
it('Test updating the database with live station data', async() => {
const result = await chai.request('https://us-central1-irishrailtracker.cloudfunctions.net')