nerdishbynature / octokit.swift

A Swift API Client for GitHub and GitHub Enterprise
MIT License
490 stars 126 forks source link

Cannot run Unit Test due to missing JSON mocks #79

Closed giulio92 closed 1 year ago

giulio92 commented 5 years ago

Hi,

I have cloned this repo and I have tried running it in Xcode but the included Unit Tests does not pass due to multiple missing JSON files. For example test FollowTests.testGetMyFollowers()

fails due to:

Fatal error: Unexpectedly found nil while unwrapping an Optional value
2019-05-09 14:25:44.158687+0200 xctest[47127:288344] Fatal error: Unexpectedly found nil while unwrapping an Optional value

the unit test is looking for a JSON file named users but this file is not included in the repo (I am using master branch).

I am running octokit.swift library on macOS Mojave 10.14.4 (18E227)

giulio92 commented 5 years ago

Any news on this?

phatblat commented 5 years ago

The users.json file is located under Tests/OctoKitTests. I tried running the Mac tests in Xcode 10.2.1 and they all pass, including FollowTests.testGetMyFollowers()

Screen Shot 2019-06-13 at 2 59 30 PM

I'm not sure why that test is failing for you, but I suggest trying a fresh clone of this repo.

captainbarbosa commented 4 years ago

@giulio92 did you generate the Xcode project with SPM? I found that if I used swift package generate-xcodeproj I would get these errors. However, not doing that and just opening the xcodeproj file fixed that for me.

pietbrauer commented 1 year ago

Closing due to inactivity and all the tests working even when using swift test on Linux.