buildasaurs / XcodeServerSDK

Access Xcode Server API with native Swift objects.
MIT License
399 stars 30 forks source link

Create request tests #74

Closed cojoj closed 9 years ago

cojoj commented 9 years ago

Oi! 🇬🇧

I've created test suite for XcodeServerEndpoints with purpose of testing createRequest() but it looks like it's mostly tested (or at least covered in other tests), so I've only created test case for malformed URLs passed to this method.

We're missing code coverage for those lines:

catch {
    let error = error as NSError
    Log.error("Parsing error \(error.description)")
    return nil
}

but it's complicated as I can't invent any failable case for NSJSONSerialization.dataWithJSONObject() as earlier we make sure we pass NSDictionary and any valid dictionary will be a valid JSON in that case.


Still no update for guard statement bug and code put directly after guard is never marked in test coverage... 😭

czechboy0 commented 9 years ago

Ignore Bitrise, I was testing it and it just doesn't work.

Anyway - to your PR, looks good. To your question - if we can always just use createRequest, then we shouldn't be testing a case that can never happen. So I think it's fine.

czechboy0 commented 9 years ago

Do you want to add more tests to this PR (is this WIP?)

cojoj commented 9 years ago

Nah, it's ready to merge as there's nothing more to test ATM!

One more thing... Let me put some emoji

😏

Okey, now it's ready 😆👍

buildasaur commented 9 years ago

Result of Integration 2

Duration: 45 seconds Result: Perfect build! All 28 tests passed. :+1: Test Coverage: 44%.

czechboy0 commented 9 years ago

Thanks @cojoj!