Skip to content

Commit

Permalink
Add integration tests for smalldatetime and datetime parameters to pr…
Browse files Browse the repository at this point in the history
…ocedure calls.
  • Loading branch information
pekim committed May 10, 2012
1 parent 9ede878 commit b5f5b95
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions test/integration/rpc-test.coffee
Expand Up @@ -45,6 +45,18 @@ exports.execProcInt = (test) ->
exports.execProcIntNull = (test) ->
testProc(test, TYPES.Int, 'int', null)

exports.execProcSmallDateTime = (test) ->
testProc(test, TYPES.SmallDateTime, 'smalldatetime', new Date('December 4, 2011 10:04:00'))

exports.execProcSmallDateTimeNull = (test) ->
testProc(test, TYPES.SmallDateTime, 'smalldatetime', null)

exports.execProcDateTime = (test) ->
testProc(test, TYPES.DateTime, 'datetime', new Date('December 4, 2011 10:04:23'))

exports.execProcDateTimeNull = (test) ->
testProc(test, TYPES.DateTime, 'datetime', null)

exports.execProcOutputVarChar = (test) ->
testProcOutput(test, TYPES.VarChar, 'varchar(10)', 'test')

Expand Down Expand Up @@ -75,6 +87,18 @@ exports.execProcOutputInt = (test) ->
exports.execProcOutputIntNull = (test) ->
testProcOutput(test, TYPES.Int, 'int', null)

exports.execProcOutputSmallDateTime = (test) ->
testProcOutput(test, TYPES.SmallDateTime, 'smalldatetime', new Date('December 4, 2011 10:04:00'))

exports.execProcOutputSmallDateTimeNull = (test) ->
testProcOutput(test, TYPES.SmallDateTime, 'smalldatetime', null)

exports.execProcOutputDateTime = (test) ->
testProcOutput(test, TYPES.DateTime, 'datetime', new Date('December 4, 2011 10:04:23'))

exports.execProcOutputDateTimeNull = (test) ->
testProcOutput(test, TYPES.DateTime, 'datetime', null)

exports.execProcWithBadName = (test) ->
test.expect(3)

Expand Down Expand Up @@ -204,7 +228,10 @@ testProc = (test, type, typeAsString, value) ->
)

request.on('row', (columns) ->
test.strictEqual(columns[0].value, value)
if (value instanceof Date)
test.strictEqual(columns[0].value.getTime(), value.getTime())
else
test.strictEqual(columns[0].value, value)
)

connection = new Connection(config)
Expand Down Expand Up @@ -263,7 +290,10 @@ testProcOutput = (test, type, typeAsString, value) ->

request.on('returnValue', (name, returnValue, metadata) ->
test.strictEqual(name, 'paramOut')
test.strictEqual(returnValue, value)
if (value instanceof Date)
test.strictEqual(returnValue.getTime(), value.getTime())
else
test.strictEqual(returnValue, value)
test.ok(metadata)
)

Expand Down

0 comments on commit b5f5b95

Please sign in to comment.