feat(bot): add multi-household setup flow

This commit is contained in:
2026-03-09 03:40:20 +04:00
parent f3991fe7ce
commit e63d81cda2
21 changed files with 3337 additions and 9 deletions

View File

@@ -2,6 +2,7 @@ import { describe, expect, test } from 'bun:test'
import {
extractPurchaseTopicCandidate,
resolveConfiguredPurchaseTopicRecord,
type PurchaseTopicCandidate
} from './purchase-topic-ingestion'
@@ -60,3 +61,28 @@ describe('extractPurchaseTopicCandidate', () => {
expect(record).toBeNull()
})
})
describe('resolveConfiguredPurchaseTopicRecord', () => {
test('returns record when the configured topic role is purchase', () => {
const record = resolveConfiguredPurchaseTopicRecord(candidate(), {
householdId: 'household-1',
role: 'purchase',
telegramThreadId: '777',
topicName: 'Общие покупки'
})
expect(record).not.toBeNull()
expect(record?.householdId).toBe('household-1')
})
test('skips non-purchase topic bindings', () => {
const record = resolveConfiguredPurchaseTopicRecord(candidate(), {
householdId: 'household-1',
role: 'feedback',
telegramThreadId: '777',
topicName: 'Feedback'
})
expect(record).toBeNull()
})
})