Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions Tests/IntegrationTests/ClientIntegrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,39 @@ struct ClientIntegratedTests {
}
}

@Test
@available(valkeySwift 1.0, *)
func testSetex() async throws {
var logger = Logger(label: "Valkey")
logger.logLevel = .debug
try await withValkeyConnection(.hostname(valkeyHostname, port: 6379), logger: logger) { connection in
try await withKey(connection: connection) { key in
try await connection.setex(key, seconds: 10, value: "Hello")
let response = try await connection.get(key).map { String(buffer: $0) }
#expect(response == "Hello")
let ttl = try await connection.ttl(key)
#expect(ttl > 0)
}
}
}

@Test
@available(valkeySwift 1.0, *)
func testSetRange() async throws {
var logger = Logger(label: "Valkey")
logger.logLevel = .debug
try await withValkeyConnection(.hostname(valkeyHostname, port: 6379), logger: logger) { connection in
try await withKey(connection: connection) { key in
try await connection.set(key, value: "Hello World")
var response = try await connection.get(key).map { String(buffer: $0) }
#expect(response == "Hello World" )
try await connection.setrange(key, offset: 6, value: "Valkey")
response = try await connection.get(key).map { String(buffer: $0) }
#expect(response == "Hello Valkey")
}
}
}

@Test
@available(valkeySwift 1.0, *)
func testSPOP() async throws {
Expand Down
Loading