Skip to content

Commit

Permalink
Added more testes of rolling prices
Browse files Browse the repository at this point in the history
  • Loading branch information
zinen committed Oct 18, 2024
1 parent 7f38ec7 commit 46e4fc2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/nordpool-api_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,22 @@ describe('nordpool-api-plus Node', function () {
msg.payload[47].should.property('timestamp')
const dateParsing = new Date(msg.payload[46].timestamp)
should.notEqual(dateParsing, 'Invalid Date')

let date = new Date()
// Date of yesterday
date = new Date(date.setDate(date.getDate() - 1))
should.equal(new Date(msg.payload[12].timestamp).getDate(), date.getDate())

// Date of today
date = new Date()
should.equal(new Date(msg.payload[36].timestamp).getDate(), date.getDate())

if (msg.payload.length > 48) {
console.log('Testing rolling data for tomorrow now')
// Date of tomorrow
date = new Date(date.setDate(date.getDate() + 1))
should.equal(new Date(msg.payload[60].timestamp).getDate(), date.getDate())
}
} catch (error) {
console.error(String(error))
console.trace(error)
Expand Down

0 comments on commit 46e4fc2

Please sign in to comment.