test/test_integration.rb in vacuum-2.1.1 vs test/test_integration.rb in vacuum-2.2.0

- old
+ new

@@ -37,15 +37,15 @@ assert res.dig('ItemSearchResponse', 'Items', 'Item') end def test_encoding_issues params = { 'SearchIndex' => 'All', 'Keywords' => 'google' } - titles = %w[BR CA CN DE ES FR GB IN IT JP US MX].flat_map do |locale| + titles = locales.flat_map do |locale| req = Vacuum.new(locale) req.associate_tag = 'foo' res = req.item_search(query: params) - items = res.dig('ItemSearchResponse', 'Items', 'Item') + items = res.dig('ItemSearchResponse', 'Items', 'Item') || [] items.map { |item| item['ItemAttributes']['Title'] } end encodings = titles.map { |t| t.encoding.name }.uniq # Newer JRuby now appears to return both US-ASCII and UTF-8, depending on @@ -57,7 +57,13 @@ req = Vacuum.new req.associate_tag = 'foo' params = { 'SearchIndex' => 'All', 'Keywords' => 'amazon' } res = req.item_search(query: params) assert_equal 'InvalidClientTokenId', res.dig('ItemSearchErrorResponse', 'Error', 'Code') + end + + private + + def locales + Request::HOSTS.keys end end