Show pending performance groups before maturity
This commit is contained in:
1 parent
55a6774daf
commit
ca59ba0f1f
5 files changed
+90
-9
No files matched your search
@@ -610,6 +610,42 @@ describe('ConversationStateRepository', () => {
|
||||
});
|
||||
|
||||
describe('Mature performance and guardrails', () => {
|
||||
it('returns pending-only strategy and subreddit groups before any samples mature', () => {
|
||||
const { postsRepo, messagesRepo } = createTestRepositories();
|
||||
const now = Date.now();
|
||||
postsRepo.insert({
|
||||
id: 'fresh', subreddit: 'new-community', author: 'fresh-user', title: 'fresh',
|
||||
imageUrl: null, processedAt: now,
|
||||
});
|
||||
messagesRepo.insert({
|
||||
postId: 'fresh', recipient: 'fresh-user', subject: 's', message: 'm',
|
||||
sentAt: now, strategyId: 'new-strategy',
|
||||
});
|
||||
|
||||
expect(messagesRepo.getStrategyStats(now - 12 * 3600000)).toEqual([{
|
||||
strategyId: 'new-strategy',
|
||||
totalSent: 0,
|
||||
totalResponses: 0,
|
||||
responseRate: 0,
|
||||
totalImages: 0,
|
||||
imageRate: 0,
|
||||
pendingSent: 1,
|
||||
responseRateLow: 0,
|
||||
responseRateHigh: 100,
|
||||
}]);
|
||||
expect(messagesRepo.getSubredditStats(now - 12 * 3600000)).toEqual([{
|
||||
subreddit: 'new-community',
|
||||
totalSent: 0,
|
||||
totalResponses: 0,
|
||||
responseRate: 0,
|
||||
totalImages: 0,
|
||||
imageRate: 0,
|
||||
pendingSent: 1,
|
||||
responseRateLow: 0,
|
||||
responseRateHigh: 100,
|
||||
}]);
|
||||
});
|
||||
|
||||
it('excludes pending sends and reports a confidence interval', () => {
|
||||
const { postsRepo, messagesRepo } = createTestRepositories();
|
||||
postsRepo.insert({ id: 'old', subreddit: 'test', author: 'old-user', title: 'old', imageUrl: null, processedAt: 1 });
|
||||
|
||||
Reference in new issue
Block a user