Skip to content
This repository was archived by the owner on Dec 10, 2024. It is now read-only.

Commit be759cd

Browse files
committed
added tests for link header
1 parent 3d9428c commit be759cd

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

JustTests/JustSpecs.swift

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,5 +640,27 @@ class JustSpec: QuickSpec {
640640
expect(r.ok).to(beTrue())
641641
}
642642
}
643+
644+
describe("link header support") {
645+
it("should always have a value for .links") {
646+
expect(Just.get("https://api.github.com/users/dduan/repos?page=1&per_page=10").links).toNot(beNil())
647+
}
648+
it("should contain key \"next\" for this specific github API") {
649+
let r = Just.get("https://api.github.com/users/dduan/repos?page=1&per_page=10")
650+
expect(r.ok).to(beTrue())
651+
expect(r.links["next"]).toNot(beNil())
652+
}
653+
it("should contain key \"last\" for this specific github API") {
654+
let r = Just.get("https://api.github.com/users/dduan/repos?page=1&per_page=10")
655+
expect(r.ok).to(beTrue())
656+
expect(r.links["last"]).toNot(beNil())
657+
}
658+
it("should contain key \"url\" in \"next\" and \"last\" for this specific github API") {
659+
let r = Just.get("https://api.github.com/users/dduan/repos?page=1&per_page=10")
660+
expect(r.links["next"]?["url"]).toNot(beNil())
661+
expect(r.links["last"]?["url"]).toNot(beNil())
662+
663+
}
664+
}
643665
}
644666
}

0 commit comments

Comments
 (0)