Skip to content

Commit

Permalink
test: assert unsubscribing
Browse files Browse the repository at this point in the history
  • Loading branch information
AuHau committed Oct 21, 2024
1 parent 4c31de3 commit d4b6ecd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion testmodule/providers/jsonrpc/rpc_mock.nim
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ proc start*(server: MockRpcHttpServer) =
if(not hasKey(server.filters, id)):
raise (ref ApplicationError)(code: -32000, msg: "filter not found")

del(server.filters, id)
server.filters.del(id)
return true

server.srv.start()
Expand Down
7 changes: 5 additions & 2 deletions testmodule/providers/jsonrpc/testJsonRpcSubscriptions.nim
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ suite "HTTP polling subscriptions - filter not found":

await sleepAsync(300.millis)
mockServer.invalidateFilter(id)
await sleepAsync(300.millis)
check mockServer.newFilterCounter == 2
check eventually mockServer.newFilterCounter == 2
check mockServer.filters[id] == false
check mockServer.filters.len() == 2
await subscriptions.unsubscribe(jsonId)
check mockServer.filters.len() == 1


0 comments on commit d4b6ecd

Please sign in to comment.