feat: establish auth listing and image vertical slices
Includes MFA-capable authentication, session and CSRF security, password recovery, listing lifecycle and ownership rules, inventory image metadata, local ImageStorage, migrations, tests, and implementation status documentation. Verification: npm test (62 passing) and integration suite (14 passing).
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
|
||||
import {
|
||||
assertInventoryItemEditable,
|
||||
INVENTORY_STATUS,
|
||||
transitionInventoryStatus,
|
||||
} from '../../src/modules/inventory/domain/inventory-item.js';
|
||||
|
||||
test('allows an active inventory item to be sold', () => {
|
||||
assert.equal(
|
||||
transitionInventoryStatus(INVENTORY_STATUS.ACTIVE, INVENTORY_STATUS.SOLD),
|
||||
INVENTORY_STATUS.SOLD,
|
||||
);
|
||||
});
|
||||
|
||||
test('rejects reopening sold inventory', () => {
|
||||
assert.throws(
|
||||
() => transitionInventoryStatus(INVENTORY_STATUS.SOLD, INVENTORY_STATUS.ACTIVE),
|
||||
/cannot transition/,
|
||||
);
|
||||
});
|
||||
|
||||
test('locks sold and archived items against ordinary edits', () => {
|
||||
assert.throws(
|
||||
() => assertInventoryItemEditable(INVENTORY_STATUS.SOLD),
|
||||
/locked against ordinary edits/,
|
||||
);
|
||||
assert.throws(
|
||||
() => assertInventoryItemEditable(INVENTORY_STATUS.ARCHIVED),
|
||||
/locked against ordinary edits/,
|
||||
);
|
||||
assert.doesNotThrow(() => assertInventoryItemEditable(INVENTORY_STATUS.ACTIVE));
|
||||
});
|
||||
Reference in New Issue
Block a user