Skip to content

Commit 6db27ae

Browse files
feat: add unit-tests to CocoaPods, update 1 test
Check changes and comments to them
1 parent 24f256b commit 6db27ae

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

EmojiPicker.podspec

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ Pod::Spec.new do |s|
1111
s.source_files = 'Sources/EmojiPicker/**/*.swift'
1212
s.resource_bundle = { "EmojiPicker" => ["Sources/EmojiPicker/**/*.lproj/*.strings"] }
1313

14+
s.test_spec 'Tests' do |test_spec|
15+
test_spec.source_files = 'Tests/**/*.{swift}'
16+
end
17+
1418
s.swift_version = '4.2'
1519
s.platform = :ios, '11.1'
1620
end

Tests/UnicodeManagerTests.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,16 @@ class UnicodeManagerTests: XCTestCase {
3636
Tests getting title for `flags` emoji category.
3737

3838
Unit-tests has no access to resource bundle so the result will be `"flags"`.
39+
But this access has CocoaPods, when it is time to do `pod lib lint`. That is why we test it in this way:
40+
* If the `result` is not equal to the expected ones, we fail our test.
3941
*/
4042
func testGettingEmojiCategoryTitle() throws {
4143
let emojiCategory = EmojiCategoryType.flags
4244

4345
let result = unicodeManager.getEmojiCategoryTitle(for: emojiCategory)
4446

45-
XCTAssertEqual(result, "flags")
47+
if result != "flags" && result != "FLAGS" {
48+
XCTFail("The expected output should be one of the expected ones, instead we got: \(result)")
49+
}
4650
}
4751
}

0 commit comments

Comments
 (0)