Skip to content

Commit

Permalink
kv tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubwro committed Jan 27, 2024
1 parent a345099 commit 7a17abf
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/jetstream.jl
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,21 @@ uint8_vec(s::String) = convert.(UInt8, collect(s))
keyvalue_stream_delete(connection, "test_kv")
end

@testset "Encoded keys" begin
connection = NATS.connect()

kv = JetStream.JetDict{String}(connection, "test_kv")
@test_throws "Key \"!@#%^&\" contains invalid character" kv["!@#%^&"] = "5"
keyvalue_stream_delete(connection, "test_kv")

kv = JetStream.JetDict{String}(connection, "test_kv", :base64url)
kv["!@#%^&"] = "5"
@test kv["!@#%^&"] = "5"
keyvalue_stream_delete(connection, "test_kv")

@test_throws "No `encodekey` implemented for wrongencoding encoding" JetStream.JetDict{String}(connection, "test_kv", :wrongencoding)
end

@testset "Create and delete KV bucket" begin
connection = NATS.connect()
bucket = randstring(10)
Expand Down

0 comments on commit 7a17abf

Please sign in to comment.