diff --git a/test/test_value_converter_factory.rb b/test/test_value_converter_factory.rb index a5f84c1..0d69eec 100644 --- a/test/test_value_converter_factory.rb +++ b/test/test_value_converter_factory.rb @@ -269,6 +269,21 @@ def test_time ).create_converter assert_equal nil, converter.call(nil) assert_equal "00:03:22.000000", converter.call("00:03:22") + assert_equal "15:22:00.000000", converter.call("3:22 PM") + assert_equal "03:22:00.000000", converter.call("3:22 AM") + assert_equal "15:22:00.000000", converter.call("15:22") + assert_equal "03:22:01.000000", converter.call("03:22:01") + assert_equal "10:00:00.000000", converter.call("2024-07-24 10:00") + + # Users must care of BQ datetime format by themselves with no timestamp_format + converter = ValueConverterFactory.new(SCHEMA_TYPE, 'TIME').create_converter + assert_equal nil, converter.call(nil) + assert_equal "00:03:22", converter.call("00:03:22") + assert_equal "15:22:00", converter.call("3:22 PM") + assert_equal "03:22:00", converter.call("3:22 AM") + assert_equal "15:22:00", converter.call("15:22") + assert_equal "03:22:01", converter.call("03:22:01") + assert_equal "10:00:00", converter.call("2024-07-24 10:00") end def test_record