Add unit tests for internal functions in used in the aggregator