fix - ASS-OLD
This commit is contained in:
@@ -121,6 +121,16 @@ test('current and archived inventory are selected separately', async () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('borrow and return history includes requests linked to archived assets', async () => {
|
||||
const oldBorrow = { BorrowId: 21, AssetId: 17, RequestType: 'borrow', IsArchived: true };
|
||||
const oldReturn = { BorrowId: 22, AssetId: 17, RequestType: 'return', IsArchived: true };
|
||||
const fixture = createFixture(() => ({ recordset: [oldBorrow, oldReturn] }));
|
||||
const response = await fixture.invoke('get', '/api/asset-borrows');
|
||||
assert.deepEqual(Array.from(response.body.data, row => row.BorrowId), [21, 22]);
|
||||
assert.match(fixture.queries[0].query, /FROM AssetBorrowRequests br\s+LEFT JOIN AssetInventory ai ON ai.AssetId = br.AssetId/);
|
||||
assert.doesNotMatch(fixture.queries[0].query, /WHERE\s+(?:br\.|ai\.)?IsArchived\s*=\s*0/i);
|
||||
});
|
||||
|
||||
test('new borrow requests cannot target an archived asset', async () => {
|
||||
const fixture = createFixture(() => ({ recordset: [{
|
||||
AssetId: 17, IsArchived: true, Quantity: 10, EndingBalance: 7,
|
||||
|
||||
Reference in New Issue
Block a user