Reduce grouped mark-gone refresh to summary fetch only
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -2,6 +2,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
const useStockItemMock = vi.fn();
|
||||
const getStockEntryMock = vi.fn();
|
||||
const listGroupedStockEntriesMock = vi.fn();
|
||||
|
||||
vi.mock('../../../src/api/stock.js', () => ({
|
||||
useStockItem: (...args) => useStockItemMock(...args),
|
||||
@@ -10,7 +11,7 @@ vi.mock('../../../src/api/stock.js', () => ({
|
||||
lookupItemDetails: vi.fn(),
|
||||
patchStockItem: vi.fn(),
|
||||
listStockEntries: vi.fn(),
|
||||
listGroupedStockEntries: vi.fn(),
|
||||
listGroupedStockEntries: (...args) => listGroupedStockEntriesMock(...args),
|
||||
updateStockItem: vi.fn(),
|
||||
}));
|
||||
|
||||
@@ -25,6 +26,7 @@ describe('stock mark-gone behavior', () => {
|
||||
beforeEach(() => {
|
||||
useStockItemMock.mockReset();
|
||||
getStockEntryMock.mockReset();
|
||||
listGroupedStockEntriesMock.mockReset();
|
||||
globalThis.window = {
|
||||
__loncApp: {
|
||||
navigate: vi.fn(),
|
||||
@@ -73,8 +75,11 @@ describe('stock mark-gone behavior', () => {
|
||||
|
||||
it('stock list grouped markGone removes item from grouped and flat collections', async () => {
|
||||
useStockItemMock.mockResolvedValueOnce({ status: 'used' });
|
||||
listGroupedStockEntriesMock.mockResolvedValueOnce([]);
|
||||
const addAlert = vi.fn();
|
||||
const data = stockListPageData({ addAlert, isConnected: false });
|
||||
const store = { addAlert, isConnected: true };
|
||||
const data = stockListPageData(store);
|
||||
data.groupedLoaded = true;
|
||||
|
||||
data.groupedEntries = [
|
||||
{
|
||||
@@ -124,5 +129,7 @@ describe('stock mark-gone behavior', () => {
|
||||
type: 'success',
|
||||
message: 'Beans was marked gone and removed from the group.',
|
||||
});
|
||||
expect(listGroupedStockEntriesMock).toHaveBeenCalledTimes(1);
|
||||
expect(listGroupedStockEntriesMock).toHaveBeenCalledWith(store, { expanded: 0 });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user