Skip to content

Commit

Permalink
fix: Revert "fix: Reconciliation bug" (#117)
Browse files Browse the repository at this point in the history
This reverts commit 6bdbf95.

Co-authored-by: vahidlazio <vahidlazio@gmail.com>
  • Loading branch information
fabriziodemaria and vahidlazio committed May 6, 2024
1 parent 587a778 commit 45135ae
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 28 deletions.
1 change: 0 additions & 1 deletion Sources/Confidence/Confidence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ public class Confidence: ConfidenceEventSender {
var map = confidence.contextFlow.value
for removedKey in removeKeys {
map.removeValue(forKey: removedKey)
confidence.removedContextKeys.insert(removedKey)
}
for entry in context {
map.updateValue(entry.value, forKey: entry.key)
Expand Down
4 changes: 0 additions & 4 deletions Sources/Confidence/Contextual.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ public protocol Contextual: ConfidenceContextProvider {
*/
func removeKey(key: String)
/**
Perform `putContext` and multiple `removeKey` at once
*/
func putContext(context: ConfidenceStruct, removeKeys: [String])
/**
Creates a child Contextual instance that maintains access to its parent's data
*/
func withContext(_ context: ConfidenceStruct) -> Self
Expand Down
23 changes: 0 additions & 23 deletions Tests/ConfidenceTests/ConfidenceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,6 @@ final class ConfidenceTests: XCTestCase {
XCTAssertEqual(confidenceChild.getContext(), expected)
}

func testWithContextUpdateParentRemoveKeys() {
let confidenceParent = Confidence.init(
clientSecret: "",
region: .europe,
eventSenderEngine: EventSenderEngineMock(),
initializationStrategy: .activateAndFetchAsync,
context: ["k1": ConfidenceValue(string: "v1")],
parent: nil
)
let confidenceChild: ConfidenceEventSender = confidenceParent.withContext(
["k2": ConfidenceValue(string: "v2")]
)
confidenceChild.putContext(
context: ["k3": ConfidenceValue(string: "v3")],
removeKeys: ["k1"]
)
let expected = [
"k2": ConfidenceValue(string: "v2"),
"k3": ConfidenceValue(string: "v3"),
]
XCTAssertEqual(confidenceChild.getContext(), expected)
}

func testUpdateLocalContext() {
let confidence = Confidence.init(
clientSecret: "",
Expand Down

0 comments on commit 45135ae

Please sign in to comment.