Skip to content

Commit

Permalink
Merge pull request #1378 from K-coder05/development
Browse files Browse the repository at this point in the history
Completed CG16 Test Case
  • Loading branch information
huss authored Nov 3, 2024
2 parents e24cdcd + 2fcaa8a commit 14becf4
Showing 1 changed file with 95 additions and 2 deletions.
97 changes: 95 additions & 2 deletions src/server/test/web/readingsCompareGroupFlow.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,101 @@ mocha.describe('readings API', () => {
expectCompareToEqualExpected(res, expected, GROUP_ID);
});

// Add CG16 here
mocha.it('CG16: 7 day shift end 2022-10-31 17:00:00 for 15 minute reading intervals and flow units & thing as thing where rate is 36 ', async () => {

const unitData = [
{
// u14
name: 'Thing_36',
identifier: '',
unitRepresent: Unit.unitRepresentType.FLOW,
secInRate: 36,
typeOfUnit: Unit.unitType.METER,
suffix: '',
displayable: Unit.displayableType.NONE,
preferredDisplay: false,
note: 'special unit'
},
{
// u15
name: 'thing unit',
identifier: '',
unitRepresent: Unit.unitRepresentType.FLOW,
secInRate: 3600,
typeOfUnit: Unit.unitType.UNIT,
suffix: '',
displayable: Unit.displayableType.ALL,
preferredDisplay: false,
note: 'special unit'
},
];
const conversionData = [
{
// c15
sourceName: 'Thing_36',
destinationName: 'thing unit',
bidirectional: false,
slope: 1,
intercept: 0,
note: 'Thing_36 → thing unit'
}
];
// meter groups
const meterDatakGroups = [
{
name: 'meterData',
unit: 'Thing_36',
defaultGraphicUnit: 'thing unit',
displayable: true,
gps: undefined,
note: 'special meter',
file: 'test/web/readingsData/readings_ri_15_days_75.csv',
deleteFile: false,
readingFrequency: '15 minutes',
id: METER_ID
},
{
name: 'meterDataOther',
unit: 'Thing_36',
defaultGraphicUnit: 'thing unit',
displayable: true,
gps: undefined,
note: 'special meter',
file: 'test/web/readingsData/readings_ri_20_days_75.csv',
deleteFile: false,
readingFrequency: '20 minutes',
id: (METER_ID + 1)
}
];
// group data
const groupData = [
{
id: GROUP_ID,
name: 'meterData + meterDataOther',
displayable: true,
note: 'special group',
defaultGraphicUnit: 'thing unit',
childMeters: ['meterData', 'meterDataOther'],
childGroups: [],
}
]

// load data into database
await prepareTest(unitData, conversionData, meterDatakGroups, groupData);
// Get the unit ID since the DB could use any value.
const unitId = await getUnitId('thing unit');
const expected = [400897.545574702, 418262.793481036];

const res = await chai.request(app).get(`/api/compareReadings/groups/${GROUP_ID}`)
.query({
curr_start: '2022-10-30 00:00:00',
curr_end: '2022-10-31 17:00:00',
shift: 'P7D',
graphicUnitId: unitId,
});
expectCompareToEqualExpected(res, expected, GROUP_ID);
});
});
});
});
});
});

0 comments on commit 14becf4

Please sign in to comment.