mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-20 11:20:41 -07:00
rollback changes to tests
This commit is contained in:
@@ -560,26 +560,6 @@ class StandardFiltersTest < Minitest::Test
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_map_with_nil_property
|
|
||||||
array = [
|
|
||||||
{ "handle" => "alpha", "value" => "A" },
|
|
||||||
{ "handle" => "beta", "value" => "B" },
|
|
||||||
{ "handle" => "gamma", "value" => "C" }
|
|
||||||
]
|
|
||||||
|
|
||||||
assert_template_result("alpha beta gamma", "{{ array | map: nil | map: 'handle' | join: ' ' }}", { "array" => array })
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_map_with_empty_string_property
|
|
||||||
array = [
|
|
||||||
{ "handle" => "alpha", "value" => "A" },
|
|
||||||
{ "handle" => "beta", "value" => "B" },
|
|
||||||
{ "handle" => "gamma", "value" => "C" }
|
|
||||||
]
|
|
||||||
|
|
||||||
assert_template_result("alpha beta gamma", "{{ array | map: '' | map: 'handle' | join: ' ' }}", { "array" => array })
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_map_with_value_property
|
def test_map_with_value_property
|
||||||
array = [
|
array = [
|
||||||
{ "handle" => "alpha", "value" => "A" },
|
{ "handle" => "alpha", "value" => "A" },
|
||||||
@@ -591,16 +571,15 @@ class StandardFiltersTest < Minitest::Test
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_map_returns_input_with_no_property
|
def test_map_returns_input_with_no_property
|
||||||
input = [
|
foo = [
|
||||||
[1],
|
[1],
|
||||||
[2],
|
[2],
|
||||||
[3],
|
[3],
|
||||||
]
|
]
|
||||||
result = @filters.map(input, nil)
|
|
||||||
assert_equal(input.flatten, result)
|
|
||||||
|
|
||||||
result = @filters.map(input, '')
|
assert_raises(Liquid::ArgumentError) do
|
||||||
assert_equal(input.flatten, result)
|
@filters.map(foo, nil)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_sort_works_on_enumerables
|
def test_sort_works_on_enumerables
|
||||||
@@ -1317,7 +1296,7 @@ class StandardFiltersTest < Minitest::Test
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_sum_with_non_string_property
|
def test_sum_with_non_string_property
|
||||||
input = [{ "true" => 1 }, { "1.0" => 0.2, "1" => -0.3 }, { "1..5" => 0.4 }]
|
input = [{ true => 1 }, { 1.0 => 0.2, 1 => -0.3 }, { 1..5 => 0.4 }]
|
||||||
|
|
||||||
assert_equal(1, @filters.sum(input, true))
|
assert_equal(1, @filters.sum(input, true))
|
||||||
assert_equal(0.2, @filters.sum(input, 1.0))
|
assert_equal(0.2, @filters.sum(input, 1.0))
|
||||||
|
|||||||
Reference in New Issue
Block a user