Skip to content

Commit

Permalink
LDEV-2298 improve test
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitzer committed Sep 29, 2023
1 parent acb5ff1 commit 2b257e7
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions test/tickets/LDEV2298.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ component extends = "org.lucee.cfml.test.LuceeTestCase" {
function run( testResults, testBox ) {
describe( "Test case for LDEV2298, inserting date with null=false, no sqltype", function(){

xit( title="queryExecute() column doesn't allow nulls", body = function( currentSpec ) {
it( title="queryExecute() column doesn't allow nulls", body = function( currentSpec ) {
local.result = _InternalRequest(
template : "#uri#\test.cfm",
forms : {Scene = 1,tablename = 'ldev2298_null'}
);
expect( result.filecontent ).toInclude("can't cast [] to date value"); // feels wrong, returns {ts '1900-01-01 00:00:00'} aka cfml epoch
expect( trim( result.filecontent) ).toInclude("{ts '1900-01-01 00:00:00'}"); // feels wrong, but that's sql server, i.e. SELECT CAST('' AS DATE)
});

xit( title="queryExecute() column allows nulls", body = function( currentSpec ) {
it( title="queryExecute() column allows nulls", body = function( currentSpec ) {
local.result = _InternalRequest(
template : "#uri#\test.cfm",
forms : {Scene = 3,tablename = 'ldev2298_notnull'}
);
expect( result.filecontent ).toInclude("can't cast [] to date value"); // feels wrong, returns {ts '1900-01-01 00:00:00'} aka cfml epoch
expect( trim( result.filecontent) ).toInclude("{ts '1900-01-01 00:00:00'}"); // feels wrong, but that's sql server, i.e. SELECT CAST('' AS DATE)
});
});

Expand All @@ -31,15 +31,15 @@ component extends = "org.lucee.cfml.test.LuceeTestCase" {
template : "#uri#\test.cfm",
forms : {Scene = 1,tablename = 'ldev2298_null', passDateParam=false}
);
expect( result.filecontent ).toInclude("param [utcNow] not found");
expect( trim( result.filecontent) ).toInclude("param [utcNow] not found");
});

it( title="queryExecute() column allows nulls", body = function( currentSpec ) {
local.result = _InternalRequest(
template : "#uri#\test.cfm",
forms : {Scene = 3,tablename = 'ldev2298_notnull', passDateParam=false}
);
expect( result.filecontent ).toInclude("param [utcNow] not found");
expect( trim( result.filecontent) ).toInclude("param [utcNow] not found");
});
});

Expand All @@ -50,15 +50,15 @@ component extends = "org.lucee.cfml.test.LuceeTestCase" {
template : "#uri#\test.cfm",
forms : {Scene = 4,tablename = 'ldev2298_null'}
);
expect( result.filecontent ).toInclude("can't cast [] to date value");
expect( trim( result.filecontent) ).toInclude("can't cast [] to date value");
});

it( title="queryExecute() column doesn't allow nulls", body = function( currentSpec ) {
local.result = _InternalRequest(
template : "#uri#\test.cfm",
forms : {Scene = 2,tablename = 'ldev2298_notnull'}
);
expect( result.filecontent ).toInclude("can't cast [] to date value");
expect( trim( result.filecontent) ).toInclude("can't cast [] to date value");
});

});
Expand All @@ -70,15 +70,15 @@ component extends = "org.lucee.cfml.test.LuceeTestCase" {
template : "#uri#\test.cfm",
forms : {Scene = 4,tablename = 'ldev2298_null', passDateParam=false}
);
expect( result.filecontent ).toInclude("param [utcNow] not found");
expect( trim( result.filecontent) ).toInclude("param [utcNow] not found");
});

it( title="queryExecute() column doesn't allow nulls", body = function( currentSpec ) {
local.result = _InternalRequest(
template : "#uri#\test.cfm",
forms : {Scene = 2,tablename = 'ldev2298_notnull', passDateParam=false}
);
expect( result.filecontent ).toInclude("param [utcNow] not found");
expect( trim( result.filecontent) ).toInclude("param [utcNow] not found");
});

});
Expand All @@ -91,15 +91,15 @@ component extends = "org.lucee.cfml.test.LuceeTestCase" {
template : "#uri#\test.cfm",
forms : {Scene = 4,tablename = 'ldev2298_null'}
);
expect( result.filecontent ).toInclude("can't cast [] to date value");
expect( trim( result.filecontent) ).toInclude("can't cast [] to date value");
});

it( title="queryExecute() column doesn't allow nulls", body = function( currentSpec ) {
local.result = _InternalRequest(
template : "#uri#\test.cfm",
forms : {Scene = 2,tablename = 'ldev2298_notnull',}
);
expect( result.filecontent ).toInclude("can't cast [] to date value");
expect( trim( result.filecontent) ).toInclude("can't cast [] to date value");
});

});
Expand All @@ -111,15 +111,15 @@ component extends = "org.lucee.cfml.test.LuceeTestCase" {
template : "#uri#\test.cfm",
forms : {Scene = 4,tablename = 'ldev2298_null', allowNull=true}
);
expect( trim( result.filecontent ) ).toBe("");
expect( trim( result.filecontent) ).toBe("");
});

it( title="queryExecute() column doesn't allow nulls", body = function( currentSpec ) {
local.result = _InternalRequest(
template : "#uri#\test.cfm",
forms : {Scene = 2,tablename = 'ldev2298_notnull',allowNull=true}
); // Cannot insert the value NULL into column
expect( result.filecontent ).toInclude("lucee.runtime.exp.DatabaseException");
expect( trim( result.filecontent) ).toInclude("lucee.runtime.exp.DatabaseException");
});

});
Expand Down

0 comments on commit 2b257e7

Please sign in to comment.