Skip to content

Commit

Permalink
add json-diff test
Browse files Browse the repository at this point in the history
  • Loading branch information
acarioni committed Oct 13, 2022
1 parent b52bffb commit 60af861
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Tests/LightstreamerClientTests/JsonPatchTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,24 @@ final class JsonPatchTests: BaseTestCase {
}
}

func testRealServer_LongJsonAndShortJson() {
client = LightstreamerClient(serverAddress: "http://localtest.me:8080", adapterSet: "TEST")
let sub = Subscription(subscriptionMode: .MERGE, items: ["count"], fields: ["count"])
sub.requestedMaxFrequency = .unfiltered
sub.requestedSnapshot = .no
sub.dataAdapter = "DIFF_JSON_COUNT"
sub.addDelegate(subDelegate)
client.subscribe(sub)
client.connect()

asyncAssert(after: 3) {
let updates = self.subDelegate.updates
XCTAssertNil(updates[0].valueAsJSONPatchIfAvailable(withFieldPos: 1))
XCTAssertNil(updates[1].valueAsJSONPatchIfAvailable(withFieldPos: 1))
XCTAssertNil(updates[2].valueAsJSONPatchIfAvailable(withFieldPos: 1))
}
}

func testPatches() {
updateTemplate([#"{"baz":"qux","foo":"bar"}"#,
#"^P[{ "op": "replace", "path": "/baz", "value": "boo" }]"#,
Expand Down

0 comments on commit 60af861

Please sign in to comment.