Skip to content

Commit

Permalink
Add network status endpoint to network report service.
Browse files Browse the repository at this point in the history
  • Loading branch information
kukabi committed Jun 19, 2024
1 parent cbbff8b commit 344bd7d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
7 changes: 7 additions & 0 deletions Sources/SubVTData/Service/REST/ReportService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,11 @@ public final class ReportService: BaseRESTService {
method: .get
)
}

public func getNetworkStatus() -> ServiceResponsePublisher<NetworkStatus> {
return perform(
path: "/network/status",
method: .get
)
}
}
17 changes: 13 additions & 4 deletions Tests/SubVTDataTests/ReportServiceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -200,24 +200,24 @@ final class ReportServiceTests: BaseTest {
testServiceCall(
publisher: service.getSessionValidatorReport(
validatorAccountId: validatorAccountId,
startSessionIndex: 36217
startSessionIndex: 39931
)
) {
(reports, error) in
XCTAssertNil(error)
XCTAssertEqual(1, reports?.count ?? 0)
let report = reports![0]
XCTAssertNotNil(report.paraVotesSummary)
XCTAssertNotNil(report.heartbeatEvent)
XCTAssertNil(report.heartbeatEvent)
}
}

func test16GetMultipleSessionValidatorReport() {
testServiceCall(
publisher: service.getSessionValidatorReport(
validatorAccountId: validatorAccountId,
startSessionIndex: 36000,
endSessionIndex: 36009
startSessionIndex: 39950,
endSessionIndex: 39959
)
) {
(reports, error) in
Expand All @@ -235,6 +235,15 @@ final class ReportServiceTests: BaseTest {
}
}

func test18GetNetworkStatus() {
testServiceCall(
publisher: service.getNetworkStatus()
) {
(networkStatus, error) in
XCTAssertNil(error)
}
}

static var allTests = [
("test01GetSingleEraReport", test01GetSingleEraReport),
("test02GetMultipleEraReport", test02GetMultipleEraReport),
Expand Down

0 comments on commit 344bd7d

Please sign in to comment.