mirror of
https://gitea.invidious.io/iv-org/shard-athena-negotiation.git
synced 2024-08-15 00:53:23 +00:00
32 lines
788 B
Crystal
32 lines
788 B
Crystal
|
require "./spec_helper"
|
||
|
|
||
|
struct AcceptLanguageTest < ASPEC::TestCase
|
||
|
@[DataProvider("accept_value_data_provider")]
|
||
|
def test_accept_value(header : String?, expected : String?) : Nil
|
||
|
ANG::AcceptLanguage.new(header).accept_value.should eq expected
|
||
|
end
|
||
|
|
||
|
def accept_value_data_provider : Tuple
|
||
|
{
|
||
|
{"en;q=0.7", "en"},
|
||
|
{"en-GB;q=0.8", "en-gb"},
|
||
|
{"da", "da"},
|
||
|
{"en-gb;q=0.8", "en-gb"},
|
||
|
{"es;q=0.7", "es"},
|
||
|
{"fr ; q= 0.1", "fr"},
|
||
|
}
|
||
|
end
|
||
|
|
||
|
@[DataProvider("header_data_provider")]
|
||
|
def test_get_value(header : String?, expected : String?) : Nil
|
||
|
ANG::AcceptLanguage.new(header).header.should eq expected
|
||
|
end
|
||
|
|
||
|
def header_data_provider : Tuple
|
||
|
{
|
||
|
{"en;q=0.7", "en;q=0.7"},
|
||
|
{"en-GB;q=0.8", "en-GB;q=0.8"},
|
||
|
}
|
||
|
end
|
||
|
end
|