Skip to content

Commit 7e0c9a4

Browse files
committed
fix(tests): Account for differences in JSON serialization
This fixes testing on iOS 8 and Linux. Closes #22
1 parent d945892 commit 7e0c9a4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Tests/JWTTests/JWTTests.swift

+10-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,16 @@ class EncodeTests: XCTestCase {
66
func testEncodingJWT() {
77
let payload = ["name": "Kyle"] as Payload
88
let jwt = JWT.encode(payload, algorithm: .hs256("secret".data(using: .utf8)!))
9-
let fixture = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiS3lsZSJ9.zxm7xcp1eZtZhp4t-nlw09ATQnnFKIiSN83uG8u6cAg"
10-
XCTAssertEqual(jwt, fixture)
9+
10+
let expected = [
11+
// { "alg": "HS256", "typ": "JWT" }
12+
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiS3lsZSJ9.zxm7xcp1eZtZhp4t-nlw09ATQnnFKIiSN83uG8u6cAg",
13+
14+
// { "typ": "JWT", "alg": "HS256" }
15+
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiS3lsZSJ9.4tCpoxfyfjbUyLjm9_zu-r52Vxn6bFq9kp6Rt9xMs4A",
16+
]
17+
18+
XCTAssertTrue(expected.contains(jwt))
1119
}
1220

1321
func testEncodingWithBuilder() {

0 commit comments

Comments
 (0)