Skip to content

Commit 9738d38

Browse files
committed
Fix test
1 parent a24b1ca commit 9738d38

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

Tests/NTLBridgeTests/JSONValueTests.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ struct JSONValueTests {
288288
}
289289

290290
let user = User(id: 1, name: "Alice", isActive: true)
291-
let jsonValue = try JSONValue(codable: user)
291+
let jsonValue = JSONValue(encodable: user)
292292

293293
#expect(jsonValue.isDictionary == true)
294294
#expect(jsonValue.dictionaryValue?["id"] == .number(1))
@@ -315,7 +315,7 @@ struct JSONValueTests {
315315
}
316316

317317
let product = Product(sku: "PRD-001", price: 29.99, inStock: true)
318-
let jsonValue = try JSONValue(codable: product)
318+
let jsonValue = JSONValue(encodable: product)
319319

320320
#expect(jsonValue.isDictionary == true)
321321
#expect(jsonValue.dictionaryValue?["sku"] == .string("PRD-001"))
@@ -332,7 +332,7 @@ struct JSONValueTests {
332332
}
333333

334334
let status = Status.active
335-
let jsonValue = try JSONValue(codable: status)
335+
let jsonValue = JSONValue(encodable: status)
336336

337337
#expect(jsonValue.isString == true)
338338
#expect(jsonValue.stringValue == "active")
@@ -346,7 +346,7 @@ struct JSONValueTests {
346346
}
347347

348348
let items = [Item(name: "Apple", quantity: 5), Item(name: "Banana", quantity: 3)]
349-
let jsonValue = try JSONValue(codable: items)
349+
let jsonValue = JSONValue(encodable: items)
350350

351351
#expect(jsonValue.isArray == true)
352352
#expect(jsonValue.arrayValue?.count == 2)
@@ -364,7 +364,7 @@ struct JSONValueTests {
364364
"license": "MIT"
365365
]
366366

367-
let jsonValue = try JSONValue(codable: metadata)
367+
let jsonValue = JSONValue(encodable: metadata)
368368

369369
#expect(jsonValue.isDictionary == true)
370370
#expect(jsonValue.dictionaryValue?["version"] == .string("1.0.0"))
@@ -394,7 +394,7 @@ struct JSONValueTests {
394394
hobbies: ["reading", "swimming", "coding"]
395395
)
396396

397-
let jsonValue = try JSONValue(codable: person)
397+
let jsonValue = JSONValue(encodable: person)
398398

399399
#expect(jsonValue.isDictionary == true)
400400
#expect(jsonValue.dictionaryValue?["name"] == .string("Bob"))
@@ -422,8 +422,8 @@ struct JSONValueTests {
422422
let configWithValues = Config(apiKey: "secret-key", debugMode: true)
423423
let configWithNil = Config(apiKey: nil, debugMode: nil)
424424

425-
let jsonValue1 = try JSONValue(codable: configWithValues)
426-
let jsonValue2 = try JSONValue(codable: configWithNil)
425+
let jsonValue1 = JSONValue(encodable: configWithValues)
426+
let jsonValue2 = JSONValue(encodable: configWithNil)
427427

428428
#expect(jsonValue1.dictionaryValue?["apiKey"] == .string("secret-key"))
429429
#expect(jsonValue1.dictionaryValue?["debugMode"] == .bool(true))
@@ -446,7 +446,7 @@ struct JSONValueTests {
446446
}
447447

448448
let user = User(userId: 123, fullName: "John Doe")
449-
let jsonValue = try JSONValue(codable: user)
449+
let jsonValue = JSONValue(encodable: user)
450450

451451
#expect(jsonValue.isDictionary == true)
452452
#expect(jsonValue.dictionaryValue?["user_id"] == .number(123))
@@ -464,7 +464,7 @@ struct JSONValueTests {
464464

465465
let date = Date(timeIntervalSince1970: 1234567890)
466466
let event = Event(name: "Conference", date: date)
467-
let jsonValue = try JSONValue(codable: event)
467+
let jsonValue = JSONValue(encodable: event)
468468

469469
#expect(jsonValue.isDictionary == true)
470470
#expect(jsonValue.dictionaryValue?["name"] == .string("Conference"))
@@ -484,7 +484,7 @@ struct JSONValueTests {
484484

485485
let content = "Hello, World!".data(using: .utf8)!
486486
let file = File(name: "greeting.txt", content: content)
487-
let jsonValue = try JSONValue(codable: file)
487+
let jsonValue = JSONValue(encodable: file)
488488

489489
#expect(jsonValue.isDictionary == true)
490490
#expect(jsonValue.dictionaryValue?["name"] == .string("greeting.txt"))

Tests/NTLBridgeTests/NTLCallInfoTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ struct NTLCallInfoTests {
797797

798798
// Compare direct Codable encoding vs JSONValue then encoding
799799
let directCallInfo = try NTLCallInfo(method: "test", callbackId: 1, codableData: user)
800-
let jsonValue = try JSONValue(codable: user)
800+
let jsonValue = JSONValue(encodable: user)
801801
let indirectCallInfo = try NTLCallInfo(method: "test", callbackId: 1, jsonData: jsonValue)
802802

803803
// Parse both JSON strings and compare the objects instead of string comparison

0 commit comments

Comments
 (0)