teqo/tests/unit/stripEngagementReversalSignalsMigration.unit.spec.ts
Cursor Agent 5335f69b43
B134 — motivo opcional (tendência + nível); remove reversalSignals
- Make engagement level note optional in schema and UI
- Remove reversalSignals field from popover, action snapshot and DB
- Add data migration to strip reversalSignals from movimento snapshots
- Wizard trend note step no longer requires text; labels show (opcional)

Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
2026-08-02 23:02:53 +00:00

23 lines
882 B
TypeScript

// @vitest-environment node
import { readFileSync } from 'node:fs'
import { describe, expect, it } from 'vitest'
const migration = readFileSync(
new URL('../../src/migrations/20260802_230000_strip_engagement_reversal_signals.ts', import.meta.url),
'utf8',
)
describe('strip engagement reversal signals migration (B134)', () => {
it('removes reversalSignals only from movimento snapshots', () => {
expect(migration).toContain("snapshot = snapshot - 'reversalSignals'")
expect(migration).toContain("outcome = 'movimento'")
expect(migration).toContain("snapshot ? 'reversalSignals'")
expect(migration).toContain('GET DIAGNOSTICS affected = ROW_COUNT')
})
it('does not attempt to restore dropped data on down', () => {
const down = migration.indexOf('export async function down')
expect(migration.indexOf('reversalSignals', down)).toBe(-1)
})
})