emojidex 0.1.0 → 0.2.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.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/emojidex.gemspec +7 -6
  3. data/lib/emojidex.rb +9 -1
  4. data/lib/emojidex/client.rb +53 -0
  5. data/lib/emojidex/data/categories.rb +42 -42
  6. data/lib/emojidex/data/category.rb +10 -10
  7. data/lib/emojidex/data/collection.rb +39 -21
  8. data/lib/emojidex/data/collection/asset_information.rb +19 -3
  9. data/lib/emojidex/data/collection/cache.rb +28 -33
  10. data/lib/emojidex/data/collection/moji_data.rb +13 -11
  11. data/lib/emojidex/data/collection/static_collection.rb +3 -3
  12. data/lib/emojidex/data/emoji.rb +54 -37
  13. data/lib/emojidex/data/emoji/asset_information.rb +86 -3
  14. data/lib/emojidex/data/extended.rb +2 -2
  15. data/lib/emojidex/data/utf.rb +2 -2
  16. data/lib/emojidex/defaults.rb +9 -1
  17. data/lib/emojidex/env_helper.rb +1 -2
  18. data/lib/emojidex/service/collection.rb +70 -31
  19. data/lib/emojidex/service/error.rb +1 -0
  20. data/lib/emojidex/service/indexes.rb +31 -10
  21. data/lib/emojidex/service/search.rb +5 -4
  22. data/lib/emojidex/service/transactor.rb +35 -19
  23. data/lib/emojidex/service/user.rb +80 -37
  24. data/lib/emojidex/service/user/history_item.rb +23 -0
  25. data/lib/emojidex/{data → util}/collection_checker.rb +2 -3
  26. metadata +10 -79
  27. data/.coveralls.yml +0 -1
  28. data/.gitignore +0 -12
  29. data/.rspec +0 -2
  30. data/.rubocop.yml +0 -18
  31. data/.travis.yml +0 -18
  32. data/Gemfile +0 -18
  33. data/Guardfile +0 -19
  34. data/README.md +0 -73
  35. data/spec/emojidex/data/categories_spec.rb +0 -19
  36. data/spec/emojidex/data/collection_checker_spec.rb +0 -72
  37. data/spec/emojidex/data/collection_spec.rb +0 -136
  38. data/spec/emojidex/data/emoji_spec.rb +0 -47
  39. data/spec/emojidex/data/extended_spec.rb +0 -118
  40. data/spec/emojidex/data/utf_spec.rb +0 -91
  41. data/spec/emojidex/service/collection_spec.rb +0 -20
  42. data/spec/emojidex/service/error_spec.rb +0 -17
  43. data/spec/emojidex/service/indexes_spec.rb +0 -62
  44. data/spec/emojidex/service/search_spec.rb +0 -87
  45. data/spec/emojidex/service/transactor_spec.rb +0 -11
  46. data/spec/emojidex/service/user_spec.rb +0 -128
  47. data/spec/spec_helper.rb +0 -18
  48. data/spec/support/Genshin.svg +0 -126
  49. data/spec/support/couple_kiss/0.svg +0 -177
  50. data/spec/support/couple_kiss/1.svg +0 -177
  51. data/spec/support/couple_kiss/10.svg +0 -293
  52. data/spec/support/couple_kiss/11.svg +0 -235
  53. data/spec/support/couple_kiss/12.svg +0 -235
  54. data/spec/support/couple_kiss/13.svg +0 -235
  55. data/spec/support/couple_kiss/14.svg +0 -177
  56. data/spec/support/couple_kiss/15.svg +0 -177
  57. data/spec/support/couple_kiss/2.svg +0 -177
  58. data/spec/support/couple_kiss/3.svg +0 -235
  59. data/spec/support/couple_kiss/4.svg +0 -235
  60. data/spec/support/couple_kiss/5.svg +0 -235
  61. data/spec/support/couple_kiss/6.svg +0 -293
  62. data/spec/support/couple_kiss/7.svg +0 -235
  63. data/spec/support/couple_kiss/8.svg +0 -235
  64. data/spec/support/couple_kiss/9.svg +0 -235
  65. data/spec/support/couple_kiss/animation.json +0 -14
  66. data/spec/support/fixtures/categories.json +0 -14
  67. data/spec/support/fixtures/category.json +0 -5
  68. data/spec/support/fixtures/emoji.json +0 -28
  69. data/spec/support/fixtures/emoji_detailed.json +0 -41
  70. data/spec/support/fixtures/search_emoji.json +0 -21
  71. data/spec/support/fixtures/single_emoji.json +0 -19
  72. data/spec/support/fixtures/single_emoji_detailed.json +0 -30
  73. data/spec/support/sample_collections/good/emoji.json +0 -30
  74. data/spec/support/sample_collections/good/mouth.svg +0 -49
  75. data/spec/support/sample_collections/good/nut_and_bolt.svg +0 -372
  76. data/spec/support/sample_collections/good/purple_heart.svg +0 -24
  77. data/spec/support/sample_collections/good/px32/mouth.png +0 -0
  78. data/spec/support/sample_collections/good/px32/nut_and_bolt.png +0 -0
  79. data/spec/support/sample_collections/good/px32/purple_heart.png +0 -0
  80. data/spec/support/sample_collections/good/px32/woman_with_bunny_ears.png +0 -0
  81. data/spec/support/sample_collections/good/woman_with_bunny_ears.svg +0 -90
  82. data/spec/support/sample_collections/missing_assets/emoji.json +0 -30
  83. data/spec/support/sample_collections/missing_assets/mouth.svg +0 -49
  84. data/spec/support/sample_collections/missing_assets/purple_heart.svg +0 -24
  85. data/spec/support/sample_collections/missing_assets/px32/mouth.png +0 -0
  86. data/spec/support/sample_collections/missing_assets/px32/nut_and_bolt.png +0 -0
  87. data/spec/support/sample_collections/missing_assets/px32/woman_with_bunny_ears.png +0 -0
  88. data/spec/support/sample_collections/missing_assets/woman_with_bunny_ears.svg +0 -90
  89. data/spec/support/sample_collections/missing_index/emoji.json +0 -23
  90. data/spec/support/sample_collections/missing_index/mouth.svg +0 -49
  91. data/spec/support/sample_collections/missing_index/nut_and_bolt.svg +0 -372
  92. data/spec/support/sample_collections/missing_index/purple_heart.svg +0 -24
  93. data/spec/support/sample_collections/missing_index/px32/mouth.png +0 -0
  94. data/spec/support/sample_collections/missing_index/px32/nut_and_bolt.png +0 -0
  95. data/spec/support/sample_collections/missing_index/px32/purple_heart.png +0 -0
  96. data/spec/support/sample_collections/missing_index/px32/woman_with_bunny_ears.png +0 -0
  97. data/spec/support/sample_collections/missing_index/woman_with_bunny_ears.svg +0 -90
@@ -1,136 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'spec_helper'
4
-
5
- require 'emojidex/defaults'
6
- require 'emojidex/data/utf'
7
- require 'emojidex/data/extended'
8
-
9
- describe Emojidex::Data::Collection do
10
- let(:collection) { Emojidex::Data::Collection.new(nil, './spec/support/sample_collections/good') }
11
- before(:each) { clear_tmp_cache }
12
-
13
- describe '.load_local_collection' do
14
- it 'loads a local collection' do
15
- expect(collection).to be_an_instance_of(Emojidex::Data::Collection)
16
- end
17
- end
18
-
19
- describe '.each' do
20
- it 'provides each emoji' do
21
- collection.each do |emoji|
22
- expect(emoji).to be_an_instance_of(Emojidex::Data::Emoji)
23
- end
24
- end
25
- end
26
-
27
- describe '.find_by_moji' do
28
- it 'finds and returns an emoji object by UTF moji code' do
29
- expect(collection.find_by_moji('👯')).to be_an_instance_of(Emojidex::Data::Emoji)
30
- end
31
-
32
- it 'returns nil when the moji code does not exist' do
33
- expect(collection.find_by_moji('XX')).to be_nil
34
- end
35
- end
36
-
37
- describe '.文字検索' do
38
- it 'find_by_moji_codeをaliasして文字コードで検索する' do
39
- expect(collection.文字検索('👯')).to be_an_instance_of(Emojidex::Data::Emoji)
40
- end
41
- end
42
-
43
- describe '.find_by_code' do
44
- it 'finds and returns an emoji by code' do
45
- ss = collection.find_by_code('nut_and_bolt')
46
- expect(ss).to be_an_instance_of(Emojidex::Data::Emoji)
47
- end
48
-
49
- it 'returns nil when a code does not exist' do
50
- expect(collection.find_by_code('super_fantastic')).to be_nil
51
- end
52
- end
53
-
54
- describe '.find_by_code_ja' do
55
- it 'finds and returns an emoji by Japanese code' do
56
- expect(collection.find_by_code_ja('ハート(紫)')).to be_an_instance_of(Emojidex::Data::Emoji)
57
- end
58
- end
59
-
60
- describe '.コード検索' do
61
- it 'find_by_code_jaをaliasして日本語の絵文字コードで検索する' do
62
- expect(collection.コード検索('ハート(紫)')).to be_an_instance_of(Emojidex::Data::Emoji)
63
- end
64
- end
65
-
66
- describe '.cache!' do
67
- it 'caches emoji to local storage cache' do
68
- collection.cache!(cache_path: tmp_cache_path, formats: [:svg])
69
- expect(collection.cache_path).to eq "#{tmp_cache_path}/emoji"
70
- expect(collection.vector_source_path).to eq collection.source_path
71
- expect(File.exist? "#{collection.vector_source_path}/mouth.svg").to be_truthy
72
- expect(File.exist? tmp_cache_path).to be_truthy
73
- expect(File.exist? "#{collection.cache_path}/mouth.svg").to be_truthy
74
- expect(File.exist? "#{collection.cache_path}/emoji.json").to be_truthy
75
- end
76
- end
77
-
78
- describe '.cache_index' do
79
- it 'caches the index to the specified location' do
80
- FileUtils.mkdir_p(tmp_cache_path)
81
- collection.cache_index tmp_cache_path
82
- expect(File.exist? tmp_cache_path + '/emoji.json').to be_truthy
83
- end
84
- end
85
-
86
- describe '.write_index' do
87
- it 'writes a cleaned index to the specified location' do
88
- FileUtils.mkdir_p(tmp_cache_path)
89
- collection.cache_index tmp_cache_path
90
- expect(File.exist? tmp_cache_path + '/emoji.json').to be_truthy
91
- end
92
- end
93
-
94
- describe '.generate_checksums' do
95
- it 'generates checksums for assets' do
96
- collection.cache!(cache_path: tmp_cache_path, formats: [:svg, :png], sizes: [:px32])
97
- expect(collection.generate_checksums).to be_an_instance_of(Array)
98
- expect(collection.emoji.values.first.checksums[:svg]).to be_truthy
99
- expect(collection.emoji.values.first.checksum?(:svg)).to be_truthy
100
- expect(collection.emoji.values.first.checksums[:png][:px32]).to be_truthy
101
- expect(collection.emoji.values.first.checksum?(:png, :px32)).to be_truthy
102
- expect(collection.emoji.values.first.checksums[:png][:px64]).to be_nil
103
- expect(collection.emoji.values.first.checksum?(:png, :px64)).to be_nil
104
- end
105
- end
106
-
107
- describe '.generate_paths' do
108
- it 'generates file paths for each emoji' do
109
- collection.cache!(cache_path: tmp_cache_path, formats: [:svg, :png], sizes: [:px32])
110
- expect(collection.generate_paths).to be_an_instance_of(Array)
111
- expect(collection.emoji.values.first.paths[:svg]).to be_truthy
112
- expect(collection.emoji.values.first.path?(:svg)).to be_truthy
113
- expect(collection.emoji.values.first.paths[:png][:px32]).to be_truthy
114
- expect(collection.emoji.values.first.path?(:png, :px32)).to be_truthy
115
- expect(collection.emoji.values.first.paths[:png][:px64]).to be_nil
116
- expect(collection.emoji.values.first.path?(:png, :px64)).to be_nil
117
- end
118
- end
119
-
120
- describe 'collections should chain combine' do
121
- it 'chain combines' do
122
- col = Emojidex::Data::Collection.new
123
- col.emoji = {}
124
- expect(col.emoji.count).to eq 0
125
-
126
- col << Emojidex::Data::UTF.new
127
- expect(col.emoji.count > 0).to be true
128
- expect(col.emoji.count).to eq (Emojidex::Data::UTF.new()).emoji.count
129
-
130
- col << Emojidex::Data::Extended.new
131
- expect(col.emoji.count > (Emojidex::Data::UTF.new()).emoji.count).to be true
132
- expect(col.emoji.count).to eq ((Emojidex::Data::UTF.new()).emoji.count +
133
- (Emojidex::Data::Extended.new()).emoji.count)
134
- end
135
- end
136
- end
@@ -1,47 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'spec_helper'
4
-
5
- describe Emojidex::Data::Emoji do
6
- let(:emoji) do
7
- Emojidex::Data::Emoji.new moji: '🌠', code: 'shooting_star',
8
- code_ja: '流れ星', category: 'cosmos',
9
- unicode: '1f320', uri: '/dummy/uri'
10
- end
11
-
12
- describe '.to_s' do
13
- it 'outputs UTF moji when present' do
14
- expect(emoji.to_s).to eq('🌠')
15
- end
16
-
17
- it 'outputs emoji code when UTF is not present' do
18
- emoji.moji = nil
19
- expect(emoji.to_s).to eq(':shooting_star:')
20
- end
21
- end
22
-
23
- describe '.to_hash' do
24
- it 'gets a hash containing emoji info' do
25
- expect(emoji.to_hash).to be_an_instance_of(Hash)
26
- end
27
- end
28
-
29
- describe '[]' do
30
- it 'acts like hash for lookup by key' do
31
- expect(emoji[:moji]).to eq(emoji.moji)
32
- end
33
- end
34
-
35
- describe '[]=' do
36
- it 'assigns a value in a hash by a key' do
37
- emoji[:code] = 'star_shot'
38
- expect(emoji.code).to eq('star_shot')
39
- end
40
- end
41
-
42
- describe '.to_json' do
43
- it 'outputs JSON info from the emoji' do
44
- expect(JSON.parse(emoji.to_json)).to be_an_instance_of(Hash)
45
- end
46
- end
47
- end
@@ -1,118 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'spec_helper'
4
- require 'emojidex/data/extended'
5
-
6
- describe Emojidex::Data::Extended do
7
- let(:ext) { Emojidex::Data::Extended.new }
8
-
9
- describe '.each' do
10
- it 'provides each emoji' do
11
- ext.each do |emoji|
12
- expect(emoji).to be_an_instance_of(Emojidex::Data::Emoji)
13
- end
14
- end
15
- end
16
-
17
- describe 'find_by_code' do
18
- it 'finds and returns an emoji by code' do
19
- expect(ext.find_by_code('combat_knife'))
20
- .to be_an_instance_of(Emojidex::Data::Emoji)
21
- end
22
-
23
- it 'finds and returns an emoji by code, converting spaces to underscores' do
24
- expect(ext.find_by_code('combat knife'))
25
- .to be_an_instance_of(Emojidex::Data::Emoji)
26
- end
27
-
28
- it 'returns nil when a code does not exist' do
29
- expect(ext.find_by_code('super_fantastic')).to be_nil
30
- end
31
- end
32
-
33
- describe 'find_by_code_ja' do
34
- it 'finds and returns an emoji by Japanese code' do
35
- expect(ext.find_by_code_ja('忍者'))
36
- .to be_an_instance_of(Emojidex::Data::Emoji)
37
- end
38
- end
39
-
40
- describe 'コード検索' do
41
- it 'find_by_code_jaをaliasして日本語の絵文字コードで検索する' do
42
- expect(ext.コード検索('忍者')).to be_an_instance_of(Emojidex::Data::Emoji)
43
- end
44
- end
45
-
46
- describe 'category' do
47
- it 'returns a collection of the specificed category' do
48
- expect(categorized = ext.category(:tools)).to be_an_instance_of(Emojidex::Data::Collection)
49
- expect(categorized.emoji.count).to be > 1
50
- end
51
- end
52
-
53
- describe 'category?' do
54
- it 'returns true when collection contains emoji in that category' do
55
- expect(ext.category?(:tools)).to be true
56
- end
57
-
58
- it 'returns false when collection does not contain emoji in that category' do
59
- expect(ext.category?(:this_is_a_fake_category_do_not_use)).to be false
60
- end
61
-
62
- it 'returns true when collection contains emoji in multple categories' do
63
- expect(ext.category?(:tools, :abstract)).to be true
64
- end
65
-
66
- it 'returns false when collection does not contain emoji in one or more categories' do
67
- expect(ext.category?(:tools, :this_is_a_fake_category_do_not_use)).to be false
68
- end
69
- end
70
-
71
- describe 'categories' do
72
- it 'is an array of categories which contain emoji in this collection' do
73
- expect(ext.categories).to be_an_instance_of(Array)
74
- expect(ext.categories.length).to be > 1
75
- end
76
- end
77
-
78
- describe 'emoji.tags' do
79
- it 'some emoji should have tags' do
80
- expect(ext.emoji[:assault_rifle].tags.length).to be > 1
81
- end
82
-
83
- it 'tags should be an array of symbols' do
84
- expect(ext.emoji[:assault_rifle].tags.include? :weapon).to be true
85
- end
86
- end
87
-
88
- describe 'search' do
89
- it 'searches for an emoji with a set of options' do
90
- expect(ext.search(code: 'apple', category: 'abstract').emoji.count).to be >= 1
91
- end
92
-
93
- it 'searches, returning an empty collection when none are found' do
94
- expect(ext.search(code: 'fake_emoji', category: 'abstract').emoji.count).to be == 0
95
- expect(ext.search(code: 'apple', category: 'fake_category').emoji.count).to be == 0
96
- end
97
-
98
- it 'returns all emoji containing the search term as a substring' do
99
- expect(ext.search(code: 'square', category: 'symbols').emoji.count).to be > 12
100
- end
101
-
102
- it 'evaluates regular expressions' do
103
- col = ext.search(code: 'emoji(?!.*dex$).*', category: 'symbols')
104
- expect(col.find_by_code('emoji')).to be_an_instance_of Emojidex::Data::Emoji
105
- expect(col.find_by_code('emojidex')).to be_nil
106
- end
107
- end
108
-
109
- describe 'load_from_server' do
110
- it 'loads index from server' do
111
- ext.emoji = {}
112
- expect(ext.emoji.count == 0).to be true
113
- expect(ext.load_from_server).to be true
114
- expect(ext.emoji.count > 0).to be true
115
- end
116
- end
117
-
118
- end
@@ -1,91 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'spec_helper'
4
- require 'emojidex/data/utf'
5
-
6
- describe Emojidex::Data::UTF do
7
- let(:utf) { Emojidex::Data::UTF.new }
8
- before(:each) { clear_tmp_cache }
9
-
10
- describe '.each' do
11
- it 'provides each emoji' do
12
- utf.each do |emoji|
13
- expect(emoji).to be_an_instance_of(Emojidex::Data::Emoji)
14
- end
15
- end
16
- end
17
-
18
- describe '.find_by_moji' do
19
- it 'finds and returns an emoji object by UTF moji code' do
20
- expect(utf.find_by_moji('🌠')).to be_an_instance_of(Emojidex::Data::Emoji)
21
- end
22
-
23
- it 'returns nil when the moji code does not exist' do
24
- expect(utf.find_by_moji('XX')).to be_nil
25
- end
26
- end
27
-
28
- describe '.文字検索' do
29
- it 'find_by_moji_codeをaliasして文字コードで検索する' do
30
- expect(utf.文字検索('🌠')).to be_an_instance_of(Emojidex::Data::Emoji)
31
- end
32
- end
33
-
34
- describe '.find_by_code' do
35
- it 'finds and returns an emoji by code' do
36
- ss = utf.find_by_code('stars')
37
- expect(ss).to be_an_instance_of(Emojidex::Data::Emoji)
38
- end
39
-
40
- it 'returns nil when a code does not exist' do
41
- expect(utf.find_by_code('super_fantastic')).to be_nil
42
- end
43
- end
44
-
45
- describe '.find_by_code_ja' do
46
- it 'finds and returns an emoji by Japanese code' do
47
- expect(utf.find_by_code_ja('流れ星')).to be_an_instance_of(Emojidex::Data::Emoji)
48
- end
49
- end
50
-
51
- describe '.コード検索' do
52
- it 'find_by_code_jaをaliasして日本語の絵文字コードで検索する' do
53
- expect(utf.コード検索('流れ星')).to be_an_instance_of(Emojidex::Data::Emoji)
54
- end
55
- end
56
-
57
- describe 'emoji[#code].variants' do
58
- it 'has collected variants for an emoji' do
59
- expect(utf.emoji[:ice_skate].variants).to be_empty
60
- expect(utf.emoji[:persevere].variants).to include(:"persevere(p)")
61
- expect(utf.emoji[:"persevere(p)"].base).to be(:persevere)
62
- end
63
- end
64
-
65
- describe '.cache!' do
66
- it 'caches emoji to local storage cache' do
67
- utf.cache!(cache_path: tmp_cache_path, formats: [:svg])
68
- expect(File.exist? tmp_cache_path).to be_truthy
69
- expect(File.exist? tmp_cache_path + '/emoji/sushi.svg').to be_truthy
70
- expect(File.exist? tmp_cache_path + '/emoji/emoji.json').to be_truthy
71
- end
72
- end
73
-
74
- describe 'cache_index' do
75
- it 'caches the collection index to the specified location' do
76
- FileUtils.mkdir_p(tmp_cache_path)
77
- utf.cache_index tmp_cache_path
78
- expect(File.exist? tmp_cache_path + '/emoji.json').to be_truthy
79
- end
80
- end
81
-
82
- describe 'load_from_server' do
83
- it 'loads index from server' do
84
- utf.emoji = {}
85
- expect(utf.emoji.count == 0).to be true
86
- expect(utf.load_from_server).to be true
87
- expect(utf.emoji.count > 0).to be true
88
- end
89
- end
90
-
91
- end
@@ -1,20 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'spec_helper'
4
-
5
- require 'emojidex/service/collection'
6
-
7
- describe Emojidex::Service::Collection do
8
- describe '.initialize' do
9
- it 'defaults to the emoji index with 50 results per page undetailed' do
10
- sc = Emojidex::Service::Collection.new
11
- expect(sc.emoji.count).to eq 50
12
- expect(sc.detailed).to be false
13
- expect(sc.endpoint).to eq 'emoji'
14
- expect(sc.page).to eq 1
15
- expect(sc.source_path).to be nil
16
- expect(sc.vector_source_path).to be nil
17
- expect(sc.raster_source_path).to be nil
18
- end
19
- end
20
- end
@@ -1,17 +0,0 @@
1
- require 'spec_helper'
2
- require 'emojidex/service/error'
3
-
4
- describe Emojidex::Service::Error do
5
- describe 'exception classes can be raised and rescued' do
6
- it 'defines exceptions' do
7
- expect(Emojidex::Service::Error.constants.length > 0).to be true
8
- end
9
-
10
- # it 'raises' do
11
- # expect(raise Emojidex::Service::Error::Unauthorized).to raise_error(
12
- # Emojidex::Service::Error::Unauthorized)
13
- # expect(raise Emojidex::Service::Error::UprocessableEntity).to raise_error(
14
- # Emojidex::Service::Error::UnprocessableEntity)
15
- # end
16
- end
17
- end
@@ -1,62 +0,0 @@
1
- require 'spec_helper'
2
- require 'emojidex/service/indexes'
3
- require 'emojidex/defaults'
4
-
5
- describe Emojidex::Service::Indexes do
6
- describe 'emoji' do
7
- it 'returns a service collection' do
8
- idx = Emojidex::Service::Indexes.emoji
9
- expect(idx).to be_a(Emojidex::Service::Collection)
10
- expect(idx.emoji.count).to be(Emojidex::Defaults.limit)
11
- idx.more
12
- expect(idx.emoji.count).to be(Emojidex::Defaults.limit * 2)
13
- expect(idx.source_path).to be nil
14
- expect(idx.vector_source_path).to be nil
15
- expect(idx.raster_source_path).to be nil
16
- end
17
- end
18
-
19
- describe 'newest' do
20
- it 'returns a service collection' do
21
- idx = Emojidex::Service::Indexes.newest
22
- expect(idx).to be_a(Emojidex::Service::Collection)
23
- expect(idx.source_path).to be nil
24
- expect(idx.vector_source_path).to be nil
25
- expect(idx.raster_source_path).to be nil
26
- end
27
- end
28
-
29
- describe 'popular' do
30
- it 'returns a service collection' do
31
- idx = Emojidex::Service::Indexes.popular
32
- expect(idx).to be_a(Emojidex::Service::Collection)
33
- expect(idx.source_path).to be nil
34
- expect(idx.vector_source_path).to be nil
35
- expect(idx.raster_source_path).to be nil
36
- end
37
- end
38
-
39
- describe 'moji_codes' do
40
- it 'returns a hash with three different types of standard emoji mappings' do
41
- codes = Emojidex::Service::Indexes.moji_codes
42
- expect(codes.key? :moji_string).to be true
43
- expect(codes[:moji_string].length > 0).to be true
44
- expect(codes.key? :moji_array).to be true
45
- expect(codes[:moji_array].length > 0).to be true
46
- expect(codes.key? :moji_index).to be true
47
- expect(codes[:moji_index].key? '💩').to be true
48
- expect(codes[:moji_index]['💩']).to eq 'poop'
49
- end
50
-
51
- it 'returns emoji mappings in Japanese' do
52
- codes = Emojidex::Service::Indexes.moji_codes('ja')
53
- expect(codes.key? :moji_string).to be true
54
- expect(codes[:moji_string].length > 0).to be true
55
- expect(codes.key? :moji_array).to be true
56
- expect(codes[:moji_array].length > 0).to be true
57
- expect(codes.key? :moji_index).to be true
58
- expect(codes[:moji_index].key? '💩').to be true
59
- expect(codes[:moji_index]['💩']).to eq 'うんち'
60
- end
61
- end
62
- end