Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tech(cleaning): Rename IdentityMap and remove Observer protocol #61

Merged
merged 3 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Sources/CohesionKit/Combine/EntityObserver+Publisher.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#if canImport(Combine)
import Combine

extension Observer {
extension EntityObserver {
/// A `Publisher` emitting the observer current value and subscribing to any subsequents new values
public var asPublisher: AnyPublisher<T, Never> {
let subject = CurrentValueSubject<T, Never>(value)
Expand Down
2 changes: 1 addition & 1 deletion Sources/CohesionKit/Observer/EntityObserver.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

/// A type registering observers on a given entity from identity storage
public struct EntityObserver<T>: Observer {
public struct EntityObserver<T> {
public typealias OnChange = (T) -> Void

public let value: T
Expand Down
15 changes: 0 additions & 15 deletions Sources/CohesionKit/Observer/Observer.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import XCTest
@testable import CohesionKit

// MARK: Store
class IdentityMapTests: XCTestCase {
class EntityStoreTests: XCTestCase {
func test_storeAggregate_nestedEntitiesAreStored() {
let entity = RootFixture(
id: 1,
Expand Down Expand Up @@ -154,7 +154,7 @@ class IdentityMapTests: XCTestCase {
}

// MARK: Find
extension IdentityMapTests {
extension EntityStoreTests {
func test_find_entityStored_noObserverAdded_returnNil() {
let identityMap = IdentityMap()
let entity = SingleNodeFixture(id: 1)
Expand Down Expand Up @@ -277,7 +277,7 @@ extension IdentityMapTests {

// MARK: Update

extension IdentityMapTests {
extension EntityStoreTests {

func test_update_entityIsAlreadyInserted_entityIsUpdated() {
let identityMap = IdentityMap()
Expand Down
Loading