From 0341edba03672c9a9b0354ed99dfc9524aab97db Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Tue, 17 Jan 2023 12:41:37 -0700 Subject: [PATCH] chore(tests): Update tests for new `autoDeriveNumericType` default --- tests/specs/Query/Abstract/BuilderGetSpec.cfc | 12 +----------- tests/specs/Query/Abstract/QueryUtilsSpec.cfc | 10 +++++----- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/tests/specs/Query/Abstract/BuilderGetSpec.cfc b/tests/specs/Query/Abstract/BuilderGetSpec.cfc index f0ef35c8..02aa798d 100644 --- a/tests/specs/Query/Abstract/BuilderGetSpec.cfc +++ b/tests/specs/Query/Abstract/BuilderGetSpec.cfc @@ -36,11 +36,7 @@ component extends="testbox.system.BaseSpec" { expect( binding.cfsqltype ).toBe( "cf_sql_varchar" ); var binding = bindings[ 2 ]; expect( binding.value ).toBe( 10 ); - if ( isACF2016() ) { - expect( binding.cfsqltype ).toBe( "cf_sql_varchar" ); - } else { - expect( binding.cfsqltype ).toBe( "cf_sql_numeric" ); - } + expect( binding.cfsqltype ).toBe( "CF_SQL_INTEGER" ); } ); it( "retreives a map of bindings", function() { @@ -56,10 +52,4 @@ component extends="testbox.system.BaseSpec" { } ); } - private boolean function isACF2016() { - return server.keyExists( "coldfusion" ) && - !server.keyExists( "lucee" ) && - left( server.coldfusion.productversion, 4 ) == "2016"; - } - } diff --git a/tests/specs/Query/Abstract/QueryUtilsSpec.cfc b/tests/specs/Query/Abstract/QueryUtilsSpec.cfc index f7432f52..3ee88667 100644 --- a/tests/specs/Query/Abstract/QueryUtilsSpec.cfc +++ b/tests/specs/Query/Abstract/QueryUtilsSpec.cfc @@ -17,17 +17,17 @@ component displayname="QueryUtilsSpec" extends="testbox.system.BaseSpec" { describe( "numbers", function() { it( "integers", function() { - expect( utils.inferSqlType( 100 ) ).toBe( "CF_SQL_NUMERIC" ); - variables.utils.setAutoDeriveNumericType( true ); expect( utils.inferSqlType( 100 ) ).toBe( "CF_SQL_INTEGER" ); variables.utils.setAutoDeriveNumericType( false ); + expect( utils.inferSqlType( 100 ) ).toBe( "CF_SQL_NUMERIC" ); + variables.utils.setAutoDeriveNumericType( true ); } ); it( "decimals", function() { - expect( utils.inferSqlType( 4.50 ) ).toBe( "CF_SQL_NUMERIC" ); - variables.utils.setAutoDeriveNumericType( true ); expect( utils.inferSqlType( 4.50 ) ).toBe( "CF_SQL_DECIMAL" ); variables.utils.setAutoDeriveNumericType( false ); + expect( utils.inferSqlType( 4.50 ) ).toBe( "CF_SQL_NUMERIC" ); + variables.utils.setAutoDeriveNumericType( true ); } ); } ); @@ -58,7 +58,7 @@ component displayname="QueryUtilsSpec" extends="testbox.system.BaseSpec" { describe( "it infers the sql type from the members of an array", function() { it( "if all the members of the array are the same", function() { - expect( utils.inferSqlType( [ 1, 2 ] ) ).toBe( "CF_SQL_NUMERIC" ); + expect( utils.inferSqlType( [ 1, 2 ] ) ).toBe( "CF_SQL_INTEGER" ); } ); it( "but defaults to CF_SQL_VARCHAR if they are different", function() {