Skip to content

Commit

Permalink
[store] added failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pjechris committed Oct 10, 2023
1 parent 534112b commit 0848e79
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion Tests/CohesionKitTests/IdentityMapTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 0848e79

Please sign in to comment.