Skip to content

Commit

Permalink
Update tests.js
Browse files Browse the repository at this point in the history
Adds in test for converting date formats.
  • Loading branch information
Jason Smedley authored and dhensby committed Mar 13, 2020
1 parent cc00e6a commit 429abe5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/common/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,12 @@ module.exports = (sql, driver) => {
t.columns.add('b', sql.DateTime2, {
nullable: true
})
t.rows.add(1, new Date('2019-03-12T11:06:59.000Z'))
t.rows.add(2, '2019-03-12T11:06:59.000Z')
t.rows.add(3, 1552388819000)
t.columns.add('c', sql.Date, {
nullable: true
})
t.rows.add(1, new Date('2019-03-12T11:06:59.000Z'), new Date('2019-03-13'))
t.rows.add(2, '2019-03-12T11:06:59.000Z', '2019-03-13T00:00:00.000Z')
t.rows.add(3, 1552388819000, 1552499543000)

let req = new TestRequest()
req.bulk(t).then(result => {
Expand All @@ -512,6 +515,7 @@ module.exports = (sql, driver) => {
assert.strictEqual(result.recordset.length, 3)
for (let i = 0; i < result.recordset.length; i++) {
assert.strictEqual(result.recordset[i].b.toISOString(), '2019-03-12T11:06:59.000Z')
assert.strictEqual(result.recordset[i].c.toISOString(), '2019-03-13T00:00:00.000Z')
}

done()
Expand Down

0 comments on commit 429abe5

Please sign in to comment.