Skip to content

Instantly share code, notes, and snippets.

@KhayalSuleymani
Created October 16, 2024 12:56
Show Gist options
  • Save KhayalSuleymani/478d088ce13d1c0cf39821b7f56e3046 to your computer and use it in GitHub Desktop.
Save KhayalSuleymani/478d088ce13d1c0cf39821b7f56e3046 to your computer and use it in GitHub Desktop.
app delegate tests
@testable import Quick
@testable import Nimble
@testable import Common
class MainTests: QuickSpec {
override class func spec() {
describe("staring to connect app for testing...") {
it ("will start from application didFinishLaunchingWithOptions...") {
expect(app.application(.shared)).to(beTrue())
expect(app.applicationDidBecomeActive(.shared)).to(beVoid())
expect(app.applicationDidEnterBackground(.shared)).to(beVoid())
}
it ("will open deeplink page when url is valid...") {
let url1 = URL(string: "demoapp://select/tab/1")!
let url2 = URL(string: "demoapp://show/photo?name=cat")!
expect(app.application(.shared, open: url1)).to(beTrue())
expect(app.application(.shared, open: url2)).to(beTrue())
}
it ("will not open page, when url is not valid...") {
if #available(iOS 16.0, *) {
expect(app.application(.shared, open: .picturesDirectory)).to(beFalse())
} else {
// Fallback on earlier versions
}
}
it ("has to override app connection property...") {
expect(app.connection.connections).to(haveCount(5))
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment