Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added test BG14 #1352

Open
wants to merge 4 commits into
base: development
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/server/test/web/readingsBarGroupQuantity.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,22 @@ mocha.describe('readings API', () => {

// Add BG13 here

// Add BG14 here
mocha.it('BG14: 1 day bars for 15 + 20 minute reading intervals and quantity units with +-inf start/end time & kWh as lbs of CO2 & chained & reversed', async () =>{
//loads data into database
huss marked this conversation as resolved.
Show resolved Hide resolved
await prepareTest(unitDatakWh, conversionDatakWh, meterDatakWhGroups, groupDatakWh);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is that the provided meters and groups have a default graphic unit of kWh but this test does not create that unit. This causes the code to fail. What needs to happen is the needed meters and groups must be created within this test. It is similar to the standard ones but modified somewhat. I created the needed code to test the solution. If you want that code or for me to commit/push the solution then let me know.

//gets unit ID
const unitId = await getUnitId('pound of CO₂');
//load data from mcsv file
huss marked this conversation as resolved.
Show resolved Hide resolved
const expected = await parseExpectedCsv('src/server/test/web/readingsData/expected_bar_group_ri_15-20_mu_kWh_gu_lbsCO2_st_-inf_et_inf_bd_1.csv');
huss marked this conversation as resolved.
Show resolved Hide resolved

const res = await chai.request(app).get(`/api/unitReadings/bar/groups/${GROUP_ID}`)
.query({
timeInterval: ETERNITY.toString(),
barWidthDays: '1',
graphicUnitId: unitId });
// Check that the API reading is equal to what it is expected to equal
expectReadingToEqualExpected(res, expected, GROUP_ID);
});
});
});
});
Expand Down
Loading