18 lines
968 B
TypeScript
18 lines
968 B
TypeScript
import { test } from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
import { summarizeMailDecisions } from '../src/main/services/mail-agent-decisions.ts'
|
|
import type { ProcessedMail } from '../src/main/services/mail-agent-decisions.ts'
|
|
|
|
test('считает важные, неважные и прежние письма без решения', (): void => {
|
|
const processed: ProcessedMail = {
|
|
first: { notify: true, reason: 'Требуется ответ' },
|
|
second: { notify: false, reason: 'Рассылка' },
|
|
third: { notify: true, reason: 'Срок' },
|
|
legacy: true
|
|
}
|
|
assert.deepEqual(summarizeMailDecisions(processed), { analyzed: 4, important: 2, unimportant: 1, withoutDecision: 1, skippedExisting: 0 })
|
|
})
|
|
|
|
test('для пустой истории возвращает нули', (): void => {
|
|
assert.deepEqual(summarizeMailDecisions({}), { analyzed: 0, important: 0, unimportant: 0, withoutDecision: 0, skippedExisting: 0 })
|
|
})
|