Skip to content

Commit

Permalink
tech(cleaning): Rename IdentityMap and remove Observer protocol (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
pjechris committed Oct 24, 2023
1 parent 9b9d85b commit 41c846b
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 20 deletions.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.

0 comments on commit 41c846b

Please sign in to comment.