From 12c21de96aaadee958ab3761f34b5a03f3a72a16 Mon Sep 17 00:00:00 2001 From: Timo <38291523+lovetodream@users.noreply.github.com> Date: Mon, 22 Apr 2024 09:18:10 +0200 Subject: [PATCH] test: add test for metadata subscript --- Tests/LoggingLokiTests/LokiLogHandlerTests.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Tests/LoggingLokiTests/LokiLogHandlerTests.swift b/Tests/LoggingLokiTests/LokiLogHandlerTests.swift index 4551c0b..74c23dd 100644 --- a/Tests/LoggingLokiTests/LokiLogHandlerTests.swift +++ b/Tests/LoggingLokiTests/LokiLogHandlerTests.swift @@ -155,6 +155,10 @@ final class LokiLogHandlerTests: XCTestCase { XCTAssertEqual(metadata7, ["hello": "how are you"]) let metadata8 = LokiLogHandler.prepareMetadata(base: ["hello": "there"], provider: .init({ ["hello": "how are you"] }), explicit: ["hello": "I am fine"]) XCTAssertEqual(metadata8, ["hello": "I am fine"]) + var handler = LokiLogHandler(label: "test", processor: .init(configuration: .init(lokiURL: ""))) + handler[metadataKey: "key"] = "value" + XCTAssertEqual(handler.metadata, ["key": "value"]) + XCTAssertEqual(handler[metadataKey: "key"], "value") } func checkIfLogExists(for transformer: TestTransformer, file: StaticString = #filePath, line: UInt = #line) throws {