-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Replace older maxmin test code with range. This only tests min/max and not the reading. - L23 was incorrectly in raw and is now in quantity. - Misc minor edits.
- Loading branch information
Showing
9 changed files
with
289 additions
and
168 deletions.
There are no files selected for viewing
62 changes: 0 additions & 62 deletions
62
...ata/expected_line_minmax__ri_15_mu_kWh_gu_kWh_st_2022-08-25000000_et_2022-10-25000000.csv
This file was deleted.
Oops, something went wrong.
76 changes: 76 additions & 0 deletions
76
src/server/test/web/readingsData/expected_line_range_ri_15_mu_kWh_gu_kWh_st_-inf_et_inf.csv
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 @@ | ||
min,max,start time,end time | ||
6.7259272013388,396.756437434564,2022-08-18 00:00:00,2022-08-19 00:00:00 | ||
4.47751407346722,395.768246876483,2022-08-19 00:00:00,2022-08-20 00:00:00 | ||
4.04110145750053,395.564911597572,2022-08-20 00:00:00,2022-08-21 00:00:00 | ||
8.46964265531555,399.401060519104,2022-08-21 00:00:00,2022-08-22 00:00:00 | ||
5.536027248112,395.703751686654,2022-08-22 00:00:00,2022-08-23 00:00:00 | ||
12.3370481373449,391.673072369915,2022-08-23 00:00:00,2022-08-24 00:00:00 | ||
9.30301762676087,396.299057260549,2022-08-24 00:00:00,2022-08-25 00:00:00 | ||
10.6426891004995,397.189849395253,2022-08-25 00:00:00,2022-08-26 00:00:00 | ||
16.5997962068877,395.109107889164,2022-08-26 00:00:00,2022-08-27 00:00:00 | ||
4.5823651802204,398.411679942704,2022-08-27 00:00:00,2022-08-28 00:00:00 | ||
15.3642573360935,394.643152087121,2022-08-28 00:00:00,2022-08-29 00:00:00 | ||
6.29056060065448,385.856740151065,2022-08-29 00:00:00,2022-08-30 00:00:00 | ||
6.86420796677648,395.563823102245,2022-08-30 00:00:00,2022-08-31 00:00:00 | ||
7.43438994317359,387.965878057152,2022-08-31 00:00:00,2022-09-01 00:00:00 | ||
11.8212615738301,399.520437427381,2022-09-01 00:00:00,2022-09-02 00:00:00 | ||
8.33718067987179,398.567045473078,2022-09-02 00:00:00,2022-09-03 00:00:00 | ||
11.4111445542779,393.389074200625,2022-09-03 00:00:00,2022-09-04 00:00:00 | ||
15.6820576786335,388.815491970447,2022-09-04 00:00:00,2022-09-05 00:00:00 | ||
6.38333585089936,397.052005292176,2022-09-05 00:00:00,2022-09-06 00:00:00 | ||
4.96432191677293,397.035480858967,2022-09-06 00:00:00,2022-09-07 00:00:00 | ||
7.67557143008119,381.204626945531,2022-09-07 00:00:00,2022-09-08 00:00:00 | ||
6.72960982731486,394.035396458706,2022-09-08 00:00:00,2022-09-09 00:00:00 | ||
5.08026786370556,398.133028735512,2022-09-09 00:00:00,2022-09-10 00:00:00 | ||
4.29407258042591,397.995914276686,2022-09-10 00:00:00,2022-09-11 00:00:00 | ||
7.43874462146493,399.60078117885,2022-09-11 00:00:00,2022-09-12 00:00:00 | ||
6.74162186785974,395.97596159838,2022-09-12 00:00:00,2022-09-13 00:00:00 | ||
4.19776432857257,398.720053843593,2022-09-13 00:00:00,2022-09-14 00:00:00 | ||
7.03930350560177,398.056285836813,2022-09-14 00:00:00,2022-09-15 00:00:00 | ||
4.55696915516148,399.432853809808,2022-09-15 00:00:00,2022-09-16 00:00:00 | ||
4.76122698910952,386.592709772111,2022-09-16 00:00:00,2022-09-17 00:00:00 | ||
4.73481997409481,398.469854942283,2022-09-17 00:00:00,2022-09-18 00:00:00 | ||
7.45500342512439,396.534786377705,2022-09-18 00:00:00,2022-09-19 00:00:00 | ||
7.00053262408678,397.119985055946,2022-09-19 00:00:00,2022-09-20 00:00:00 | ||
7.42313016152277,398.265853881631,2022-09-20 00:00:00,2022-09-21 00:00:00 | ||
9.67235053788254,398.374776981315,2022-09-21 00:00:00,2022-09-22 00:00:00 | ||
5.16339174456368,399.186850998811,2022-09-22 00:00:00,2022-09-23 00:00:00 | ||
17.9386480149719,395.141115538206,2022-09-23 00:00:00,2022-09-24 00:00:00 | ||
5.8614423320328,399.516915252127,2022-09-24 00:00:00,2022-09-25 00:00:00 | ||
6.17122260696813,399.282645580328,2022-09-25 00:00:00,2022-09-26 00:00:00 | ||
8.70731392274497,394.801202250496,2022-09-26 00:00:00,2022-09-27 00:00:00 | ||
6.34851521671069,389.992328627658,2022-09-27 00:00:00,2022-09-28 00:00:00 | ||
8.24508983064327,390.345172000417,2022-09-28 00:00:00,2022-09-29 00:00:00 | ||
6.76368360147995,391.989085803109,2022-09-29 00:00:00,2022-09-30 00:00:00 | ||
9.10871262767975,398.972222072231,2022-09-30 00:00:00,2022-10-01 00:00:00 | ||
7.7582582413418,391.792833080551,2022-10-01 00:00:00,2022-10-02 00:00:00 | ||
8.12940656028438,392.052627840932,2022-10-02 00:00:00,2022-10-03 00:00:00 | ||
6.52102579118526,395.797276038057,2022-10-03 00:00:00,2022-10-04 00:00:00 | ||
9.87881993328141,395.1212023417,2022-10-04 00:00:00,2022-10-05 00:00:00 | ||
6.2135087268549,393.89547811125,2022-10-05 00:00:00,2022-10-06 00:00:00 | ||
5.07981940271682,391.978187648988,2022-10-06 00:00:00,2022-10-07 00:00:00 | ||
7.67023150518067,396.694931535236,2022-10-07 00:00:00,2022-10-08 00:00:00 | ||
7.80832979853782,390.851636573745,2022-10-08 00:00:00,2022-10-09 00:00:00 | ||
4.96334387737906,398.367605692982,2022-10-09 00:00:00,2022-10-10 00:00:00 | ||
9.19451095623433,397.732493942879,2022-10-10 00:00:00,2022-10-11 00:00:00 | ||
4.24986840379062,396.549993967159,2022-10-11 00:00:00,2022-10-12 00:00:00 | ||
7.74352609726317,399.270028335499,2022-10-12 00:00:00,2022-10-13 00:00:00 | ||
10.9035712482694,398.86461625213,2022-10-13 00:00:00,2022-10-14 00:00:00 | ||
8.63879474383298,389.390695109621,2022-10-14 00:00:00,2022-10-15 00:00:00 | ||
6.65847376258746,396.806189953665,2022-10-15 00:00:00,2022-10-16 00:00:00 | ||
8.67954780394319,398.534598443111,2022-10-16 00:00:00,2022-10-17 00:00:00 | ||
4.09507794602362,395.940654417433,2022-10-17 00:00:00,2022-10-18 00:00:00 | ||
8.97579673030268,398.955275738124,2022-10-18 00:00:00,2022-10-19 00:00:00 | ||
11.6088771786759,398.856149589119,2022-10-19 00:00:00,2022-10-20 00:00:00 | ||
6.03539364717974,397.49600341666,2022-10-20 00:00:00,2022-10-21 00:00:00 | ||
4.31986049410596,399.340673406538,2022-10-21 00:00:00,2022-10-22 00:00:00 | ||
22.9053626180102,396.812861365527,2022-10-22 00:00:00,2022-10-23 00:00:00 | ||
4.20468190549354,392.839138915141,2022-10-23 00:00:00,2022-10-24 00:00:00 | ||
27.7472830952505,396.731604745749,2022-10-24 00:00:00,2022-10-25 00:00:00 | ||
4.47778260991617,399.558616555955,2022-10-25 00:00:00,2022-10-26 00:00:00 | ||
4.0462991348737,398.412310485797,2022-10-26 00:00:00,2022-10-27 00:00:00 | ||
8.53981265314293,396.940512915872,2022-10-27 00:00:00,2022-10-28 00:00:00 | ||
5.39809958171692,393.535108782051,2022-10-28 00:00:00,2022-10-29 00:00:00 | ||
18.2196506846333,396.819564194905,2022-10-29 00:00:00,2022-10-30 00:00:00 | ||
8.72795862355026,398.153898839684,2022-10-30 00:00:00,2022-10-31 00:00:00 | ||
4.89617899878394,399.628936218779,2022-10-31 00:00:00,2022-11-01 00:00:00 |
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,32 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
/* | ||
This file tests the readings retrieval API line chart flow meters. | ||
See: https://github.com/OpenEnergyDashboard/DesignDocs/blob/main/testing/testing.md for information. | ||
*/ | ||
|
||
const { chai, mocha, app } = require('../common'); | ||
const Unit = require('../../models/Unit'); | ||
const { prepareTest, | ||
parseExpectedCsv, | ||
expectReadingToEqualExpected, | ||
getUnitId, | ||
ETERNITY, | ||
METER_ID } = require('../../util/readingsUtils'); | ||
|
||
mocha.describe('readings API', () => { | ||
mocha.describe('readings test, test if data returned by API is as expected', () => { | ||
mocha.describe('for line charts', () => { | ||
mocha.describe('for flow meters', () => { | ||
|
||
// Add LR8 here | ||
|
||
// Add LR25 here | ||
|
||
// Add LR26 here | ||
}); | ||
}); | ||
}); | ||
}); |
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,74 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
/* | ||
This file tests the readings retrieval API for line chart quantity meters. | ||
See: https://github.com/OpenEnergyDashboard/DesignDocs/blob/main/testing/testing.md for information. | ||
*/ | ||
|
||
const { chai, mocha, app } = require('../common'); | ||
const Unit = require('../../models/Unit'); | ||
const { prepareTest, | ||
parseExpectedCsv, | ||
expectRangeToEqualExpected, | ||
createTimeString, | ||
getUnitId, | ||
ETERNITY, | ||
METER_ID, | ||
unitDatakWh, | ||
conversionDatakWh, | ||
meterDatakWh } = require('../../util/readingsUtils'); | ||
|
||
mocha.describe('readings API', () => { | ||
mocha.describe('readings test, test if data returned by API is as expected', () => { | ||
mocha.describe('for line charts', () => { | ||
mocha.describe('for range (min/max)', () => { | ||
mocha.describe('for quantity meters', () => { | ||
// Test using a date range of infinity, which should return as days | ||
mocha.it('LR1: range should have daily points for 15 minute reading intervals and quantity units with +-inf start/end time & kWh as kWh', async () => { | ||
// Load the data into the database | ||
await prepareTest(unitDatakWh, conversionDatakWh, meterDatakWh); | ||
// Get the unit ID since the DB could use any value. | ||
const unitId = await getUnitId('kWh'); | ||
// Load the expected response data from the corresponding csv file | ||
const expected = await parseExpectedCsv('src/server/test/web/readingsData/expected_line_range_ri_15_mu_kWh_gu_kWh_st_-inf_et_inf.csv'); | ||
// Create a request to the API for unbounded reading times and save the response | ||
const res = await chai.request(app).get(`/api/unitReadings/line/meters/${METER_ID}`) | ||
.query({ timeInterval: ETERNITY.toString(), graphicUnitId: unitId }); | ||
// Check that the API reading is equal to what it is expected to equal | ||
expectRangeToEqualExpected(res, expected); | ||
}); | ||
|
||
// Add LR2 here | ||
|
||
// Add LR3 here | ||
|
||
// Add LR4 here | ||
|
||
// Add LR5 here | ||
|
||
// Add LR6 here | ||
|
||
// Add LR7 here | ||
|
||
// Add LR10 here | ||
|
||
// Add LR11 here | ||
|
||
// Add LR12 here | ||
|
||
// Add LR13 here | ||
|
||
// Add LR18 here | ||
|
||
// Add LR19 here | ||
|
||
// Add LR20 here | ||
|
||
// Add LR21 here | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
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,44 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
/* | ||
This file tests the readings retrieval API for line chart raw meters. | ||
See: https://github.com/OpenEnergyDashboard/DesignDocs/blob/main/testing/testing.md for information. | ||
*/ | ||
|
||
const { chai, mocha, app } = require('../common'); | ||
const Unit = require('../../models/Unit'); | ||
const { prepareTest, | ||
parseExpectedCsv, | ||
expectReadingToEqualExpected, | ||
createTimeString, | ||
getUnitId, | ||
ETERNITY, | ||
METER_ID, | ||
unitDatakWh, | ||
conversionDatakWh, | ||
meterDatakWh } = require('../../util/readingsUtils'); | ||
|
||
mocha.describe('readings API', () => { | ||
mocha.describe('readings test, test if data returned by API is as expected', () => { | ||
mocha.describe('for line charts', () => { | ||
mocha.describe('for range (min/max)', () => { | ||
mocha.describe('for raw meters', () => { | ||
|
||
// Add LR9 here | ||
|
||
// Add LR14 here | ||
|
||
// Add LR15 here | ||
|
||
// Add LR16 here | ||
|
||
// Add LR17 here | ||
|
||
// Add LR22 here | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.