From 2b257e7f1405b48957fb8d5ae4dd55722b446234 Mon Sep 17 00:00:00 2001 From: Zac Spitzer Date: Fri, 29 Sep 2023 17:45:48 +0200 Subject: [PATCH] LDEV-2298 improve test --- test/tickets/LDEV2298.cfc | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/test/tickets/LDEV2298.cfc b/test/tickets/LDEV2298.cfc index 97dec4a1f4..9f3f070e56 100644 --- a/test/tickets/LDEV2298.cfc +++ b/test/tickets/LDEV2298.cfc @@ -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) }); }); @@ -31,7 +31,7 @@ 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 ) { @@ -39,7 +39,7 @@ component extends = "org.lucee.cfml.test.LuceeTestCase" { 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"); }); }); @@ -50,7 +50,7 @@ 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 ) { @@ -58,7 +58,7 @@ component extends = "org.lucee.cfml.test.LuceeTestCase" { 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"); }); }); @@ -70,7 +70,7 @@ 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 ) { @@ -78,7 +78,7 @@ component extends = "org.lucee.cfml.test.LuceeTestCase" { 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"); }); }); @@ -91,7 +91,7 @@ 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 ) { @@ -99,7 +99,7 @@ component extends = "org.lucee.cfml.test.LuceeTestCase" { 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"); }); }); @@ -111,7 +111,7 @@ 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 ) { @@ -119,7 +119,7 @@ component extends = "org.lucee.cfml.test.LuceeTestCase" { 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"); }); });