Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
unsync committed Jan 26, 2024
1 parent de63095 commit fe7d5af
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/veolia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ export class VeoliaClient {
}

return soapBody.map((r: any) => {
this.logger.info(`VeoliaClient > getEnergyData > ${dayjs(r.dateReleve).toISOString()}: ${r.consommation}`)
return {
start: dayjs(r.dateReleve).startOf('day').add(12, 'hour').toISOString(),
start: dayjs(r.dateReleve).add(6, 'hour').set('hour', 0).add(12, 'hour').toISOString(),
state: r.consommation,
// veolia set the index to the start of the day,
// so we need to add the consumption to get the end of the day index
Expand Down
2 changes: 1 addition & 1 deletion test/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ export const mockEnergyData = '\n'
+ 'Content-Transfer-Encoding: binary\n'
+ 'Content-ID: <[email protected]>\n'
+ '\n'
+ '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:getConsommationJournaliereResponse xmlns:ns2="http://ws.icl.veolia.com/"><return><codeRetour>00</codeRetour><consommation>200</consommation><dateReleve>2023-10-26T00:00:00+02:00</dateReleve><fiabiliteIndex>M</fiabiliteIndex><index>34374</index></return><return><codeRetour>00</codeRetour><consommation>142</consommation><dateReleve>2023-10-27T00:00:00+02:00</dateReleve><fiabiliteIndex>M</fiabiliteIndex><index>34574</index></return></ns2:getConsommationJournaliereResponse></soap:Body></soap:Envelope>\n'
+ '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:getConsommationJournaliereResponse xmlns:ns2="http://ws.icl.veolia.com/"><return><codeRetour>00</codeRetour><consommation>200</consommation><dateReleve>2023-10-26T00:00:00+02:00</dateReleve><fiabiliteIndex>M</fiabiliteIndex><index>34374</index></return><return><codeRetour>00</codeRetour><consommation>142</consommation><dateReleve>2023-10-29T00:00:00+02:00</dateReleve><fiabiliteIndex>M</fiabiliteIndex><index>34574</index></return></ns2:getConsommationJournaliereResponse></soap:Body></soap:Envelope>\n'
+ '--uuid:8ad230ff-7d22-45bf-9e5e-19161316f835--'
2 changes: 1 addition & 1 deletion test/veolia.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ it('should fetch data', async () => {
state: 200,
sum: 34574,
}, {
start: '2023-10-27T10:00:00.000Z',
start: '2023-10-29T10:00:00.000Z',
state: 142,
sum: 34716,
}],
Expand Down

0 comments on commit fe7d5af

Please sign in to comment.