I am currently utilizing "chai": "^4.2.0"
and "mocha": "^6.1.4",
.
Upon using assert.equal()
to compare two dates, I encounter a discrepancy where the comparison returns false despite the dates appearing the same. Here is an example of the situation:
https://i.sstatic.net/dSnQz.png
Below is the test scenario in question:
it('check if dates are correctly added', async () => {
let dataArr = [{'rating_date':'6/6/2019','impact_on_price':'Low'}]
let priceServ = new PriceService()
// Clear all existing records
priceServ.clearPriceTable()
// Add 1 new record
const res = await priceServ.createOrUpdatePrice(dataArr)
// Retrieve all records from the table with a specific action attribute
const tableValues = await priceServ.getPricesByField('rating_date')
assert.equal(tableValues[0].rating_date, new Date(dataArr[0].rating_date));
});
Any guidance or insights on what might be causing this issue would be greatly appreciated.
Thank you in advance for your responses!