wovnrb 3.11.0 → 3.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,217 +1,228 @@
1
- require 'test_helper'
2
-
3
- module Wovnrb
4
- REQUEST_UUID = 'ABCD'.freeze
5
-
6
- class ApiTranslatorTest < WovnMiniTest
7
- def test_translate
8
- assert_translation('test.html', 'test_translated.html', true)
9
- end
10
-
11
- def test_translate_falls_back_to_original_body_if_exception
12
- Net::HTTP.any_instance.expects(:request).raises
13
- assert_translation('test.html', 'test_translated.html', false, response: nil)
14
- end
15
-
16
- def test_translate_falls_back_to_original_body_if_api_error
17
- assert_translation('test.html', 'test_translated.html', false, response: { encoding: 'text/json', status_code: 500 })
18
- end
19
-
20
- def test_translate_continues_if_api_response_is_not_compressed
21
- assert_translation('test.html', 'test_translated.html', true, response: { encoding: 'unknown', status: 200 }, compress_data: false)
22
- end
23
-
24
- def test_translate_continues_if_api_response_is_compressed
25
- assert_translation('test.html', 'test_translated.html', true, response: { encoding: 'unknown', status: 200 })
26
- end
27
-
28
- def test_translate_accepts_uncompressed_response_from_api_in_dev_mode
29
- Wovnrb::Store.instance.update_settings('wovn_dev_mode' => true)
30
- assert_translation('test.html', 'test_translated.html', true, response: { encoding: 'text/json', status: 200 }, compress_data: false)
31
- end
32
-
33
- def test_translate_without_api_compression_sends_json
34
- Wovnrb::Store.instance.update_settings('compress_api_requests' => false)
35
- sut, _store, _headers = create_sut
36
- html_body = 'foo'
37
-
38
- stub_request(:post, %r{http://wovn\.global\.ssl\.fastly\.net/v0/translation\?cache_key=.*})
39
- .to_return(status: 200, body: { 'body' => 'translated_body' }.to_json)
40
-
41
- sut.translate(html_body)
42
-
43
- assert_requested :post, %r{http://wovn\.global\.ssl\.fastly\.net/v0/translation\?cache_key=.*},
44
- headers: {
45
- 'Accept' => '*/*',
46
- 'Accept-Encoding' => 'gzip',
47
- 'Content-Type' => 'application/json',
48
- 'User-Agent' => 'Ruby',
49
- 'X-Request-Id' => REQUEST_UUID
50
- },
51
- body: {
52
- 'url' => 'http://wovn.io/test',
53
- 'token' => '123456',
54
- 'lang_code' => 'fr',
55
- 'url_pattern' => 'subdomain',
56
- 'lang_param_name' => 'lang',
57
- 'translate_canonical_tag' => true,
58
- 'insert_hreflangs' => true,
59
- 'product' => 'WOVN.rb',
60
- 'version' => VERSION,
61
- 'body' => 'foo',
62
- 'custom_lang_aliases' => { 'ja' => 'Japanese' }.to_json
63
- }.to_json,
64
- times: 1
65
- end
66
-
67
- def test_api_timeout_is_search_engine_user_higher_default
68
- settings = {
69
- 'project_token' => '123456',
70
- 'custom_lang_aliases' => { 'ja' => 'Japanese' },
71
- 'default_lang' => 'en',
72
- 'url_pattern' => 'subdomain',
73
- 'url_pattern_reg' => '^(?<lang>[^.]+)\.',
74
- 'lang_param_name' => 'lang'
75
- }
76
- store = Wovnrb::Store.instance
77
- store.update_settings(settings)
78
- headers = Wovnrb::Headers.new(
79
- Wovnrb.get_env('url' => 'http://fr.wovn.io/test', 'HTTP_USER_AGENT' => 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'),
80
- Wovnrb.get_settings(settings),
81
- UrlLanguageSwitcher.new(store)
82
- )
83
- api_translator = ApiTranslator.new(store, headers, REQUEST_UUID)
84
- assert_equal(5.0, api_translator.send(:api_timeout))
85
- end
86
-
87
- def test_api_timeout_no_user_agent_use_normal_default
88
- settings = {
89
- 'project_token' => '123456',
90
- 'custom_lang_aliases' => { 'ja' => 'Japanese' },
91
- 'default_lang' => 'en',
92
- 'url_pattern' => 'subdomain',
93
- 'url_pattern_reg' => '^(?<lang>[^.]+)\.',
94
- 'lang_param_name' => 'lang'
95
- }
96
- store = Wovnrb::Store.instance
97
- store.update_settings(settings)
98
- env = Wovnrb.get_env('url' => 'http://fr.wovn.io/test')
99
- env.delete('HTTP_USER_AGENT')
100
- headers = Wovnrb::Headers.new(
101
- env,
102
- Wovnrb.get_settings(settings),
103
- UrlLanguageSwitcher.new(store)
104
- )
105
- api_translator = ApiTranslator.new(store, headers, REQUEST_UUID)
106
- assert_equal(1.0, api_translator.send(:api_timeout))
107
- end
108
-
109
- private
110
-
111
- def assert_translation(original_html_fixture, translated_html_fixture, success_expected, response: { encoding: 'gzip', status_code: 200 }, compress_data: true)
112
- original_html = File.read("test/fixtures/html/#{original_html_fixture}")
113
- translated_html = File.read("test/fixtures/html/#{translated_html_fixture}")
114
- actual_translated_html = translate(original_html, translated_html, response, compress_data: compress_data)
115
-
116
- if success_expected
117
- assert_equal(actual_translated_html, translated_html)
118
- else
119
- assert_equal(actual_translated_html, original_html)
120
- end
121
- end
122
-
123
- def translate(original_html, translated_html, response, compress_data: true)
124
- api_translator, store, _headers = create_sut
125
- translation_request_stub = stub_translation_api_request(store, original_html, translated_html, response, compress_data: compress_data)
126
-
127
- expected_api_timeout = store.settings['api_timeout_seconds']
128
- assert_equal(expected_api_timeout, api_translator.send(:api_timeout))
129
- actual_translated_html = api_translator.translate(original_html)
130
- assert_requested(translation_request_stub, times: 1) if translation_request_stub
131
- actual_translated_html
132
- end
133
-
134
- def create_sut
135
- settings = {
136
- 'project_token' => '123456',
137
- 'custom_lang_aliases' => { 'ja' => 'Japanese' },
138
- 'default_lang' => 'en',
139
- 'url_pattern' => 'subdomain',
140
- 'url_pattern_reg' => '^(?<lang>[^.]+)\.',
141
- 'lang_param_name' => 'lang'
142
- }
143
- store = Wovnrb::Store.instance
144
- store.update_settings(settings)
145
- headers = Wovnrb::Headers.new(
146
- Wovnrb.get_env('url' => 'http://fr.wovn.io/test'),
147
- Wovnrb.get_settings(settings),
148
- UrlLanguageSwitcher.new(store)
149
- )
150
- api_translator = ApiTranslator.new(store, headers, REQUEST_UUID)
151
-
152
- [api_translator, store, headers]
153
- end
154
-
155
- def stub_translation_api_request(store, original_html, translated_html, response, compress_data: true)
156
- if response
157
- cache_key = generate_cache_key(store, original_html)
158
- api_host = if store.dev_mode?
159
- 'dev-wovn.io:3001'
160
- else
161
- 'wovn.global.ssl.fastly.net'
162
- end
163
- api_url = "http://#{api_host}/v0/translation?cache_key=#{cache_key}"
164
- compressed_data = compress(generate_data(original_html))
165
- headers = {
166
- 'Accept' => '*/*',
167
- 'Accept-Encoding' => 'gzip',
168
- 'Content-Length' => compressed_data.bytesize,
169
- 'Content-Type' => 'application/json',
170
- 'Content-Encoding' => 'gzip',
171
- 'User-Agent' => 'Ruby'
172
- }
173
- stub_response_json = "{\"body\":\"#{translated_html.gsub("\n", '\n')}\"}"
174
- stub_response = if compress_data
175
- compress(stub_response_json)
176
- else
177
- stub_response_json
178
- end
179
- response_headers = { 'Content-Encoding' => response[:encoding] || 'gzip' }
180
- stub_request(:post, api_url)
181
- .with(body: compressed_data, headers: headers)
182
- .to_return(status: response[:status_code] || 200, body: stub_response, headers: response_headers)
183
-
184
- end
185
- end
186
-
187
- def generate_cache_key(store, original_html)
188
- settings_hash = Digest::MD5.hexdigest(JSON.dump(store.settings))
189
- body_hash = Digest::MD5.hexdigest(original_html)
190
- escaped_key = CGI.escape("token=123456&settings_hash=#{settings_hash}&body_hash=#{body_hash}&path=/test&lang=fr&version=wovnrb_#{VERSION}")
191
-
192
- "(#{escaped_key})"
193
- end
194
-
195
- def generate_data(original_html)
196
- data = {
197
- 'url' => 'http://wovn.io/test',
198
- 'token' => '123456',
199
- 'lang_code' => 'fr',
200
- 'url_pattern' => 'subdomain',
201
- 'lang_param_name' => 'lang',
202
- 'translate_canonical_tag' => true,
203
- 'insert_hreflangs' => true,
204
- 'product' => 'WOVN.rb',
205
- 'version' => VERSION,
206
- 'body' => original_html,
207
- 'custom_lang_aliases' => '{"ja":"Japanese"}'
208
- }
209
-
210
- data.to_json
211
- end
212
-
213
- def compress(string)
214
- ActiveSupport::Gzip.compress(string)
215
- end
216
- end
217
- end
1
+ require 'test_helper'
2
+
3
+ module Wovnrb
4
+ REQUEST_UUID = 'ABCD'.freeze
5
+
6
+ class ApiTranslatorTest < WovnMiniTest
7
+ def test_translate
8
+ assert_translation('test.html', 'test_translated.html', true)
9
+ end
10
+
11
+ def test_translate_falls_back_to_original_body_if_exception
12
+ Net::HTTP.any_instance.expects(:request).raises
13
+ assert_translation('test.html', 'test_translated.html', false, api_response: nil)
14
+ end
15
+
16
+ def test_translate_falls_back_to_original_body_if_api_error
17
+ assert_translation('test.html', 'test_translated.html', false, api_response: { encoding: 'text/json', status: 500 })
18
+ end
19
+
20
+ def test_translate_continues_if_api_response_is_not_compressed
21
+ assert_translation('test.html', 'test_translated.html', true, api_response: { encoding: 'unknown', status: 200 }, compress_data: false)
22
+ end
23
+
24
+ def test_translate_continues_if_api_response_is_compressed
25
+ assert_translation('test.html', 'test_translated.html', true, api_response: { encoding: 'unknown', status: 200 })
26
+ end
27
+
28
+ def test_translate_accepts_uncompressed_response_from_api_in_dev_mode
29
+ Wovnrb::Store.instance.update_settings('wovn_dev_mode' => true)
30
+ assert_translation('test.html', 'test_translated.html', true, api_response: { encoding: 'text/json', status: 200 }, compress_data: false)
31
+ end
32
+
33
+ def test_translate_without_api_compression_sends_json
34
+ Wovnrb::Store.instance.update_settings('compress_api_requests' => false)
35
+ original_status_code = 201
36
+ sut, _store, _headers = create_sut(status: original_status_code)
37
+ html_body = 'foo'
38
+
39
+ stub_request(:post, %r{http://wovn\.global\.ssl\.fastly\.net/v0/translation\?cache_key=.*})
40
+ .to_return(status: 200, body: { 'body' => 'translated_body' }.to_json)
41
+
42
+ sut.translate(html_body)
43
+
44
+ assert_requested :post, %r{http://wovn\.global\.ssl\.fastly\.net/v0/translation\?cache_key=.*},
45
+ headers: {
46
+ 'Accept' => '*/*',
47
+ 'Accept-Encoding' => 'gzip',
48
+ 'Content-Type' => 'application/json',
49
+ 'User-Agent' => 'Ruby',
50
+ 'X-Request-Id' => REQUEST_UUID
51
+ },
52
+ body: {
53
+ 'url' => 'http://wovn.io/test',
54
+ 'token' => '123456',
55
+ 'lang_code' => 'fr',
56
+ 'url_pattern' => 'subdomain',
57
+ 'lang_param_name' => 'lang',
58
+ 'translate_canonical_tag' => true,
59
+ 'insert_hreflangs' => true,
60
+ 'hreflang_x_default_lang' => nil,
61
+ 'product' => 'WOVN.rb',
62
+ 'version' => VERSION,
63
+ 'page_status_code' => original_status_code,
64
+ 'body' => 'foo',
65
+ 'custom_lang_aliases' => { 'ja' => 'Japanese' }.to_json
66
+ }.to_json,
67
+ times: 1
68
+ end
69
+
70
+ def test_api_timeout_is_search_engine_user_higher_default
71
+ settings = {
72
+ 'project_token' => '123456',
73
+ 'custom_lang_aliases' => { 'ja' => 'Japanese' },
74
+ 'default_lang' => 'en',
75
+ 'url_pattern' => 'subdomain',
76
+ 'url_pattern_reg' => '^(?<lang>[^.]+)\.',
77
+ 'lang_param_name' => 'lang'
78
+ }
79
+ store = Wovnrb::Store.instance
80
+ store.update_settings(settings)
81
+ headers = Wovnrb::Headers.new(
82
+ Wovnrb.get_env('url' => 'http://fr.wovn.io/test', 'HTTP_USER_AGENT' => 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'),
83
+ Wovnrb.get_settings(settings),
84
+ UrlLanguageSwitcher.new(store)
85
+ )
86
+ api_translator = ApiTranslator.new(store, headers, REQUEST_UUID, 200)
87
+ assert_equal(5.0, api_translator.send(:api_timeout))
88
+ end
89
+
90
+ def test_api_timeout_no_user_agent_use_normal_default
91
+ settings = {
92
+ 'project_token' => '123456',
93
+ 'custom_lang_aliases' => { 'ja' => 'Japanese' },
94
+ 'default_lang' => 'en',
95
+ 'url_pattern' => 'subdomain',
96
+ 'url_pattern_reg' => '^(?<lang>[^.]+)\.',
97
+ 'lang_param_name' => 'lang'
98
+ }
99
+ store = Wovnrb::Store.instance
100
+ store.update_settings(settings)
101
+ env = Wovnrb.get_env('url' => 'http://fr.wovn.io/test')
102
+ env.delete('HTTP_USER_AGENT')
103
+ headers = Wovnrb::Headers.new(
104
+ env,
105
+ Wovnrb.get_settings(settings),
106
+ UrlLanguageSwitcher.new(store)
107
+ )
108
+ api_translator = ApiTranslator.new(store, headers, REQUEST_UUID, 200)
109
+ assert_equal(1.0, api_translator.send(:api_timeout))
110
+ end
111
+
112
+ private
113
+
114
+ def assert_translation(original_html_fixture, translated_html_fixture, success_expected, original_response: { status: 200 }, api_response: { encoding: 'gzip', status: 200 }, compress_data: true)
115
+ original_html = File.read("test/fixtures/html/#{original_html_fixture}")
116
+ translated_html = File.read("test/fixtures/html/#{translated_html_fixture}")
117
+ actual_translated_html = translate(original_html, translated_html, original_response, api_response, compress_data: compress_data)
118
+
119
+ if success_expected
120
+ assert_equal(actual_translated_html, translated_html)
121
+ else
122
+ assert_equal(actual_translated_html, original_html)
123
+ end
124
+ end
125
+
126
+ def translate(original_html, translated_html, original_response, api_response, compress_data: true)
127
+ api_translator, store, _headers = create_sut(original_response)
128
+ translation_request_stub = stub_translation_api_request(store, original_html, translated_html, original_response, api_response, compress_data: compress_data)
129
+
130
+ expected_api_timeout = store.settings['api_timeout_seconds']
131
+ assert_equal(expected_api_timeout, api_translator.send(:api_timeout))
132
+ actual_translated_html = api_translator.translate(original_html)
133
+ assert_requested(translation_request_stub, times: 1) if translation_request_stub
134
+ actual_translated_html
135
+ end
136
+
137
+ def create_sut(response)
138
+ settings = {
139
+ 'project_token' => '123456',
140
+ 'custom_lang_aliases' => { 'ja' => 'Japanese' },
141
+ 'default_lang' => 'en',
142
+ 'url_pattern' => 'subdomain',
143
+ 'url_pattern_reg' => '^(?<lang>[^.]+)\.',
144
+ 'lang_param_name' => 'lang'
145
+ }
146
+ store = Wovnrb::Store.instance
147
+ store.update_settings(settings)
148
+ headers = Wovnrb::Headers.new(
149
+ Wovnrb.get_env('url' => 'http://fr.wovn.io/test'),
150
+ Wovnrb.get_settings(settings),
151
+ UrlLanguageSwitcher.new(store)
152
+ )
153
+ status = if response
154
+ response[:status]
155
+ else
156
+ 200
157
+ end
158
+ api_translator = ApiTranslator.new(store, headers, REQUEST_UUID, status)
159
+
160
+ [api_translator, store, headers]
161
+ end
162
+
163
+ def stub_translation_api_request(store, original_html, translated_html, original_response, api_response, compress_data: true)
164
+ if api_response
165
+ cache_key = generate_cache_key(store, original_html)
166
+ api_host = if store.dev_mode?
167
+ 'dev-wovn.io:3001'
168
+ else
169
+ 'wovn.global.ssl.fastly.net'
170
+ end
171
+ api_url = "http://#{api_host}/v0/translation?cache_key=#{cache_key}"
172
+ expected_data = generate_data(original_html, original_response[:status])
173
+ compressed_data = compress(expected_data)
174
+ headers = {
175
+ 'Accept' => '*/*',
176
+ 'Accept-Encoding' => 'gzip',
177
+ 'Content-Length' => compressed_data.bytesize,
178
+ 'Content-Type' => 'application/json',
179
+ 'Content-Encoding' => 'gzip',
180
+ 'User-Agent' => 'Ruby'
181
+ }
182
+ stub_response_json = "{\"body\":\"#{translated_html.gsub("\n", '\n')}\"}"
183
+ stub_response = if compress_data
184
+ compress(stub_response_json)
185
+ else
186
+ stub_response_json
187
+ end
188
+ response_headers = { 'Content-Encoding' => api_response[:encoding] || 'gzip' }
189
+ stub_request(:post, api_url)
190
+ .with(body: compressed_data, headers: headers)
191
+ .to_return(status: api_response[:status] || 200, body: stub_response, headers: response_headers)
192
+
193
+ end
194
+ end
195
+
196
+ def generate_cache_key(store, original_html)
197
+ settings_hash = Digest::MD5.hexdigest(JSON.dump(store.settings))
198
+ body_hash = Digest::MD5.hexdigest(original_html)
199
+ escaped_key = CGI.escape("token=123456&settings_hash=#{settings_hash}&body_hash=#{body_hash}&path=/test&lang=fr&version=wovnrb_#{VERSION}")
200
+
201
+ "(#{escaped_key})"
202
+ end
203
+
204
+ def generate_data(original_html, expected_status)
205
+ data = {
206
+ 'url' => 'http://wovn.io/test',
207
+ 'token' => '123456',
208
+ 'lang_code' => 'fr',
209
+ 'url_pattern' => 'subdomain',
210
+ 'lang_param_name' => 'lang',
211
+ 'translate_canonical_tag' => true,
212
+ 'insert_hreflangs' => true,
213
+ 'hreflang_x_default_lang' => nil,
214
+ 'product' => 'WOVN.rb',
215
+ 'version' => VERSION,
216
+ 'page_status_code' => expected_status,
217
+ 'body' => original_html,
218
+ 'custom_lang_aliases' => '{"ja":"Japanese"}'
219
+ }
220
+
221
+ data.to_json
222
+ end
223
+
224
+ def compress(string)
225
+ ActiveSupport::Gzip.compress(string)
226
+ end
227
+ end
228
+ end
@@ -66,7 +66,7 @@ module Wovnrb
66
66
  'english.foo.com' => 'en'
67
67
  }
68
68
 
69
- assert(hash_equals(expected, @custom_domain_langs.to_html_swapper_hash))
69
+ assert(hash_equals?(expected, @custom_domain_langs.to_html_swapper_hash))
70
70
  end
71
71
 
72
72
  private
@@ -75,7 +75,7 @@ module Wovnrb
75
75
  custom_domain_lang.lang
76
76
  end
77
77
 
78
- def hash_equals(orig_hash, test_hash)
78
+ def hash_equals?(orig_hash, test_hash)
79
79
  (orig_hash <=> test_hash) == 0
80
80
  end
81
81
  end
@@ -1,59 +1,59 @@
1
- require 'test_helper'
2
-
3
- module Wovnrb
4
- class LangTest < WovnMiniTest
5
- def test_langs_exist
6
- refute_nil(Wovnrb::Lang::LANG)
7
- end
8
-
9
- def test_keys_exist
10
- Wovnrb::Lang::LANG.each do |k, l|
11
- assert(l.key?(:name))
12
- assert(l.key?(:code))
13
- assert(l.key?(:en))
14
- assert_equal(k, l[:code])
15
- end
16
- end
17
-
18
- def test_iso_639_1_normalization
19
- Wovnrb::Lang::LANG.each do |_, l|
20
- case l[:code]
21
- when 'zh-CHS'
22
- assert_equal('zh-Hans', Lang.iso_639_1_normalization('zh-CHS'))
23
- when 'zh-CHT'
24
- assert_equal('zh-Hant', Lang.iso_639_1_normalization('zh-CHT'))
25
- else
26
- assert_equal(l[:code], Lang.iso_639_1_normalization(l[:code]))
27
- end
28
- end
29
- end
30
-
31
- def test_get_code_with_valid_code
32
- assert_equal('ms', Wovnrb::Lang.get_code('ms'))
33
- end
34
-
35
- def test_get_code_with_capital_letters
36
- assert_equal('zh-CHT', Wovnrb::Lang.get_code('zh-cht'))
37
- end
38
-
39
- def test_get_code_with_valid_english_name
40
- assert_equal('pt', Wovnrb::Lang.get_code('Portuguese'))
41
- end
42
-
43
- def test_get_code_with_valid_native_name
44
- assert_equal('hi', Wovnrb::Lang.get_code('हिन्दी'))
45
- end
46
-
47
- def test_get_code_with_invalid_name
48
- assert_nil(Wovnrb::Lang.get_code('WOVN4LYFE'))
49
- end
50
-
51
- def test_get_code_with_empty_string
52
- assert_nil(Wovnrb::Lang.get_code(''))
53
- end
54
-
55
- def test_get_code_with_nil
56
- assert_nil(Wovnrb::Lang.get_code(nil))
57
- end
58
- end
59
- end
1
+ require 'test_helper'
2
+
3
+ module Wovnrb
4
+ class LangTest < WovnMiniTest
5
+ def test_langs_exist
6
+ refute_nil(Wovnrb::Lang::LANG)
7
+ end
8
+
9
+ def test_keys_exist
10
+ Wovnrb::Lang::LANG.each do |k, l|
11
+ assert(l.key?(:name))
12
+ assert(l.key?(:code))
13
+ assert(l.key?(:en))
14
+ assert_equal(k, l[:code])
15
+ end
16
+ end
17
+
18
+ def test_iso_639_1_normalization
19
+ Wovnrb::Lang::LANG.each_value do |l|
20
+ case l[:code]
21
+ when 'zh-CHS'
22
+ assert_equal('zh-Hans', Lang.iso_639_1_normalization('zh-CHS'))
23
+ when 'zh-CHT'
24
+ assert_equal('zh-Hant', Lang.iso_639_1_normalization('zh-CHT'))
25
+ else
26
+ assert_equal(l[:code], Lang.iso_639_1_normalization(l[:code]))
27
+ end
28
+ end
29
+ end
30
+
31
+ def test_get_code_with_valid_code
32
+ assert_equal('ms', Wovnrb::Lang.get_code('ms'))
33
+ end
34
+
35
+ def test_get_code_with_capital_letters
36
+ assert_equal('zh-CHT', Wovnrb::Lang.get_code('zh-cht'))
37
+ end
38
+
39
+ def test_get_code_with_valid_english_name
40
+ assert_equal('pt', Wovnrb::Lang.get_code('Portuguese'))
41
+ end
42
+
43
+ def test_get_code_with_valid_native_name
44
+ assert_equal('hi', Wovnrb::Lang.get_code('हिन्दी'))
45
+ end
46
+
47
+ def test_get_code_with_invalid_name
48
+ assert_nil(Wovnrb::Lang.get_code('WOVN4LYFE'))
49
+ end
50
+
51
+ def test_get_code_with_empty_string
52
+ assert_nil(Wovnrb::Lang.get_code(''))
53
+ end
54
+
55
+ def test_get_code_with_nil
56
+ assert_nil(Wovnrb::Lang.get_code(nil))
57
+ end
58
+ end
59
+ end