1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273
|
# frozen_string_literal: true
require_relative 'test_helper'
class TestJaLocale < Test::Unit::TestCase
def setup
Faker::Config.locale = 'ja'
end
def teardown
Faker::Config.locale = nil
end
def test_ja_address_methods
assert_kind_of String, Faker::Address.postcode
# Added Actual Japanese Zipcodes in lib/locals/ja.yml
assert_match(/\A\d{3}-\d{4}\z/, Faker::Address.postcode)
assert_not_english(Faker::Address.postcode)
assert_kind_of String, Faker::Address.state
assert_not_english(Faker::Address.state)
assert_kind_of String, Faker::Address.state_abbr
assert_not_english(Faker::Address.state_abbr)
assert_kind_of String, Faker::Address.city_prefix
assert_not_english(Faker::Address.city_prefix)
assert_kind_of String, Faker::Address.city_suffix
assert_not_english(Faker::Address.city_suffix)
assert_kind_of String, Faker::Address.city
assert_not_english(Faker::Address.city)
assert_kind_of String, Faker::Address.street_name
assert_not_english(Faker::Address.street_name)
end
def test_ja_adjective_methods
assert_kind_of String, Faker::Adjective.positive
assert_not_english(Faker::Adjective.positive)
assert_kind_of String, Faker::Adjective.negative
assert_not_english(Faker::Adjective.negative)
end
def test_ja_ancient_methods
assert_kind_of String, Faker::Ancient.god
assert_not_english(Faker::Ancient.god)
end
def test_ja_artist_method
assert_kind_of String, Faker::Artist.name
assert_not_english(Faker::Artist.name)
end
def test_ja_cat_methods
assert_kind_of String, Faker::Creature::Cat.breed
assert_not_match(/[a-zA-Z]/, Faker::Creature::Cat.breed)
end
def test_ja_color_methods
assert_kind_of String, Faker::Color.color_name
assert_not_english(Faker::Color.color_name)
end
def test_ja_book_methods
assert_kind_of String, Faker::Book.title
assert_not_english(Faker::Book.title)
assert_kind_of String, Faker::Book.author
assert_not_english(Faker::Book.author)
assert_kind_of String, Faker::Book.publisher
assert_not_english(Faker::Book.publisher)
assert_kind_of String, Faker::Book.genre
assert_not_english(Faker::Book.genre)
end
def test_ja_coffee_methods
assert_kind_of String, Faker::Coffee.country
assert_not_english(Faker::Coffee.country)
end
def test_ja_commerce_methods
assert_kind_of String, Faker::Commerce.department
assert_not_english(Faker::Commerce.department)
assert_kind_of String, Faker::Commerce.product_name
assert_not_english(Faker::Commerce.product_name)
assert_kind_of String, Faker::Commerce.promotion_code
assert_not_english(Faker::Commerce.promotion_code)
end
def test_ja_company_methods
assert_kind_of String, Faker::Company.suffix
assert_not_english(Faker::Company.suffix)
assert_kind_of String, Faker::Company.category
assert_not_english(Faker::Company.category)
assert_kind_of String, Faker::Company.name
assert_not_english(Faker::Company.name)
end
def test_ja_dog_methods
assert_kind_of String, Faker::Creature::Dog.breed
assert_not_match(/[a-zA-Z]/, Faker::Creature::Dog.breed)
end
def test_ja_emotion_methods
assert_kind_of String, Faker::Emotion.noun
assert_not_english(Faker::Emotion.noun)
assert_kind_of String, Faker::Emotion.adjective
assert_not_english(Faker::Emotion.adjective)
end
def test_ja_food_methods
assert_kind_of String, Faker::Food.sushi
assert_not_english(Faker::Food.sushi)
end
def test_ja_gender_methods
assert_kind_of String, Faker::Gender.binary_type
assert_not_english(Faker::Gender.binary_type)
end
def test_ja_lorem_methods
assert_kind_of Array, Faker::Lorem.words
assert Faker::Lorem.words(number: 1000)
assert Faker::Lorem.words(number: 10_000, supplemental: true)
assert_not_match(/ /, Faker::Lorem.paragraph)
end
def test_ja_name_methods
assert_kind_of String, Faker::Name.last_name
assert_not_english(Faker::Name.last_name)
assert_kind_of String, Faker::Name.first_name
assert_not_english(Faker::Name.first_name)
assert_kind_of String, Faker::Name.name
assert_not_english(Faker::Name.name)
assert_kind_of String, Faker::Name.name_with_middle
assert_not_english(Faker::Name.name_with_middle)
end
def test_ja_phone_number_methods
assert_kind_of String, Faker::PhoneNumber.cell_phone
assert_not_english(Faker::PhoneNumber.cell_phone)
assert_kind_of String, Faker::PhoneNumber.phone_number
assert_not_english(Faker::PhoneNumber.phone_number)
end
def test_ja_overwatch_methods
assert_kind_of String, Faker::Games::Overwatch.hero
hero = Faker::Games::Overwatch.hero
assert_not_english(hero) unless hero == 'D.Va'
end
def test_ja_pokemon_methods
assert_kind_of String, Faker::Games::Pokemon.name
assert_not_english(Faker::Games::Pokemon.name)
assert_kind_of String, Faker::Games::Pokemon.location
assert_not_english(Faker::Games::Pokemon.location)
assert_kind_of String, Faker::Games::Pokemon.move
assert_not_english(Faker::Games::Pokemon.move)
end
def test_ja_supermario_methods
assert_kind_of String, Faker::Games::SuperMario.character
assert_not_english(Faker::Games::SuperMario.character)
assert_kind_of String, Faker::Games::SuperMario.game
assert_not_english(Faker::Games::SuperMario.game)
assert_kind_of String, Faker::Games::SuperMario.location
assert_not_english(Faker::Games::SuperMario.location)
end
def test_ja_touhou_methods
assert_kind_of String, Faker::Games::Touhou.game
assert_not_english(Faker::Games::Touhou.game)
assert_kind_of String, Faker::Games::Touhou.character
assert_not_english(Faker::Games::Touhou.character)
assert_kind_of String, Faker::Games::Touhou.location
assert_not_english(Faker::Games::Touhou.location)
assert_kind_of String, Faker::Games::Touhou.spell_card
assert_not_english(Faker::Games::Touhou.spell_card)
assert_kind_of String, Faker::Games::Touhou.song
assert_not_english(Faker::Games::Touhou.song)
end
def test_ja_zelda_methods
assert_kind_of String, Faker::Games::Zelda.game
assert_not_english(Faker::Games::Zelda.game)
end
def test_ja_restaurant_methods
assert_kind_of String, Faker::Restaurant.name
assert_not_english(Faker::Restaurant.name)
assert_kind_of String, Faker::Restaurant.type
assert_not_english(Faker::Restaurant.type)
end
def test_ja_space_methods
assert_kind_of String, Faker::Space.planet
assert_not_english(Faker::Space.planet)
assert_kind_of String, Faker::Space.galaxy
end
def test_ja_studio_ghibli_methods
assert_kind_of String, Faker::JapaneseMedia::StudioGhibli.character
assert_not_english(Faker::JapaneseMedia::StudioGhibli.character)
assert_kind_of String, Faker::JapaneseMedia::StudioGhibli.quote
assert_not_english(Faker::JapaneseMedia::StudioGhibli.quote)
assert_kind_of String, Faker::JapaneseMedia::StudioGhibli.movie
assert_not_english(Faker::JapaneseMedia::StudioGhibli.movie)
end
def test_ja_naruto_methods
assert_kind_of String, Faker::JapaneseMedia::Naruto.character
assert_not_english(Faker::JapaneseMedia::Naruto.character)
assert_kind_of String, Faker::JapaneseMedia::Naruto.village
assert_not_english(Faker::JapaneseMedia::Naruto.village)
assert_kind_of String, Faker::JapaneseMedia::Naruto.eye
assert_not_english(Faker::JapaneseMedia::Naruto.eye)
assert_kind_of String, Faker::JapaneseMedia::Naruto.demon
assert_not_english(Faker::JapaneseMedia::Naruto.demon)
end
def test_ja_subscription_methods
assert_kind_of String, Faker::Subscription.plan
assert_not_english(Faker::Subscription.plan)
assert_kind_of String, Faker::Subscription.status
assert_not_english(Faker::Subscription.status)
assert_kind_of String, Faker::Subscription.payment_method
assert Array.new(10) { Faker::Subscription.payment_method }.any? { |word| !word.match?(/[a-zA-Z]/) }
assert_kind_of String, Faker::Subscription.subscription_term
assert_not_english(Faker::Subscription.subscription_term)
assert_kind_of String, Faker::Subscription.payment_term
assert_not_english(Faker::Subscription.payment_term)
end
def test_ja_university_methods
assert_kind_of String, Faker::University.prefix
assert_not_english(Faker::University.prefix)
assert_kind_of String, Faker::University.suffix
assert_not_english(Faker::University.suffix)
assert_kind_of String, Faker::University.name
assert_not_english(Faker::University.name)
end
def test_ja_sport_methods
assert_kind_of String, Faker::Sport.sport
assert_not_english(Faker::Sport.sport)
assert_kind_of String, Faker::Sport.summer_olympics_sport
assert_not_english(Faker::Sport.summer_olympics_sport)
assert_kind_of String, Faker::Sport.winter_olympics_sport
assert_not_english(Faker::Sport.winter_olympics_sport)
assert_kind_of String, Faker::Sport.summer_paralympics_sport
assert_not_english(Faker::Sport.summer_paralympics_sport)
assert_kind_of String, Faker::Sport.winter_paralympics_sport
assert_not_english(Faker::Sport.winter_paralympics_sport)
assert_kind_of String, Faker::Sport.ancient_olympics_sport
assert_not_english(Faker::Sport.ancient_olympics_sport)
assert_kind_of String, Faker::Sport.unusual_sport
assert_not_english(Faker::Sport.unusual_sport)
end
def test_ja_football_methods
# The translation of "team" includes alphabets, so we cannot use assert_not_english for assertion.
# Example: "FCバルセロナ" (FC Barcelona)
assert_kind_of String, Faker::Sports::Football.team
assert_kind_of String, Faker::Sports::Football.player
assert_not_english(Faker::Sports::Football.player)
assert_kind_of String, Faker::Sports::Football.coach
assert_not_english(Faker::Sports::Football.coach)
# The translation of "competition" includes alphabets, so we cannot use assert_not_english for assertion.
# Example: "UEFAチャンピオンズリーグ" (UEFA Champions League)
assert_kind_of String, Faker::Sports::Football.competition
assert_kind_of String, Faker::Sports::Football.position
assert_not_english(Faker::Sports::Football.position)
end
end
|