MEGAINFRA-WEBAPP/scripts/migrations/2026-10-01-add-dn-line-posting.test.mjs
DEls ed69b517e8 Integrate agent work and add dashboard attention indicators
Remove repeated Plant, Financial and Workforce shortcut cards. Add site-scoped Plant and Financial sidebar attention status with automatic refresh.

Include accumulated delivery processing, purchase order recovery, supplier reconciliation, plant data and user management changes and audit records.
2026-10-04 21:53:32 +02:00

10 lines
767 B
JavaScript

import {test} from 'node:test';
import assert from 'node:assert/strict';
import {normalizeIndex} from './2026-10-01-add-dn-line-posting.mjs';
test('normalizes PocketBase formatting without losing uniqueness or the partial index guard',()=>{
const planned="CREATE UNIQUE INDEX idx_dn_allocation_key ON delivery_note_items (allocation_key) WHERE allocation_key != ''";
const returned="CREATE UNIQUE INDEX `idx_dn_allocation_key` ON `DELIVERY_NOTE_ITEMS` (`allocation_key`) WHERE allocation_key != ''";
assert.equal(normalizeIndex(planned),normalizeIndex(returned));
assert.notEqual(normalizeIndex(planned),normalizeIndex(planned.replace('UNIQUE','')));
assert.notEqual(normalizeIndex(planned),normalizeIndex(planned.replace("WHERE allocation_key != ''",'')));
});