From 0848e7912b2bbf9ff2df177637accc2d142ff100 Mon Sep 17 00:00:00 2001 From: pjechris Date: Tue, 10 Oct 2023 13:34:01 +0200 Subject: [PATCH] [store] added failing tests --- Tests/CohesionKitTests/IdentityMapTests.swift | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Tests/CohesionKitTests/IdentityMapTests.swift b/Tests/CohesionKitTests/IdentityMapTests.swift index 7c4afec..f8e0a64 100644 --- a/Tests/CohesionKitTests/IdentityMapTests.swift +++ b/Tests/CohesionKitTests/IdentityMapTests.swift @@ -141,7 +141,7 @@ class IdentityMapTests: XCTestCase { wait(for: [expectation], timeout: 0) } - func test_storeAlias_itEnqueuesAliasInRegistry() { + func test_storeAggregate_named_itEnqueuesAliasInRegistry() { let root = SingleNodeFixture(id: 1) let registry = ObserverRegistryStub() let identityMap = IdentityMap(registry: registry) @@ -218,6 +218,23 @@ extension IdentityMapTests { } } + func test_find_storedByAliasCollection_itReturnsEntity() { + let identityMap = IdentityMap() + + _ = identityMap.store(entities: [SingleNodeFixture(id: 1)], named: .listOfNodes) + + XCTAssertNotNil(identityMap.find(SingleNodeFixture.self, id: 1)) + } + + func test_find_storedByAliasAggregate_itReturnsEntity() { + let identityMap = IdentityMap() + let aggregate = RootFixture(id: 1, primitive: "", singleNode: SingleNodeFixture(id: 1), listNodes: []) + + _ = identityMap.store(entity: aggregate, named: .root) + + XCTAssertNotNil(identityMap.find(SingleNodeFixture.self, id: 1)) + } + func test_findNamed_entityStored_noObserver_returnValue() { let identityMap = IdentityMap() let entity = SingleNodeFixture(id: 1)