IndexAggregation unit tests#100
Conversation
Remaining tests created |
| fun testAllResources() = runBlocking { | ||
| val expected = shards.map { it.allResources() }.toList().reduce { acc, map -> acc + map } | ||
| val allResources = indexAggregation.allResources() | ||
| assertEquals(9, allResources.size) // 3 resources per shard, so 3 shards * 3 resources |
There was a problem hiding this comment.
We should also test situation when resource sets from different shards intersect.
E.g.
shard1: a, b, c
shard2: c, d, e
shard3: e, f, g
Aggregation: a, b, c, d, e, f, g
| } | ||
|
|
||
| @Test | ||
| fun testAllResourcesEmpty() = runBlocking { |
There was a problem hiding this comment.
I would call it something like "empty aggregation contains no resources".
| @Test | ||
| fun testGetResourceNotFound() = runBlocking { | ||
| val indexAggregation = IndexAggregation(setOf()) | ||
| val result = indexAggregation.getResource(ResourceId(0, 123456789)) |
There was a problem hiding this comment.
Ids with zero size are forbidden actually. Let's create dedicated test case for this somewhere (not really relevant to aggregation).
About this test case, let's create a constant for an "arbitrary id which is not in the index".
|
@tuancoltech would be great if you could take over this PR. We need to re-create it though, because it originates in @oluiscabral fork. |
@kirillt Sure, I'll take it over. |
|
Superseded by: |
Just as note. This PR still a draft.
It has to test those methods yet:
getResource(id: ResourceId);allPaths();getPath(id: ResourceId);updateAll().