Skip to content

Commit 7f7ad24

Browse files
author
webdev778
committed
Add detector tests
1 parent 15eb471 commit 7f7ad24

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

ruby/spec/detector_spec.rb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
RSpec.describe Interscript::Detector do
2+
it "should return valid data when map_pattern is selected and multiple is true" do
3+
out = Interscript.detect(
4+
"привет", "privet",
5+
map_pattern: "icao-ukr-*",
6+
multiple: true,
7+
compiler: Interscript::Compiler::Ruby
8+
)
9+
expected = {"icao-ukr-Cyrl-Latn-9303" => 1.0}
10+
expect(out).to eq(expected)
11+
end
12+
13+
it "should return valid data when map_pattern isn't selected and multiple is false" do
14+
out = Interscript.detect("привет", "privet", compiler: Interscript::Compiler::Ruby)
15+
expect(out).to be_a(String)
16+
end
17+
18+
it "should return valid data when map_pattern isn't selected and multiple is true" do
19+
out = Interscript.detect(
20+
"привет", "privet",
21+
multiple: true,
22+
compiler: Interscript::Compiler::Ruby,
23+
)
24+
expect(out).to be_a(Hash)
25+
expect(out.keys.all? { |i| i.class == String }).to be true
26+
expect(out.values.all? { |i| Numeric === i }).to be true
27+
end
28+
end

0 commit comments

Comments
 (0)