Refactor stock API to replace numeric flags with boolean values, add getItemLabel endpoint, and update tests/documentation
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -130,6 +130,6 @@ describe('stock mark-gone behavior', () => {
|
||||
message: 'Beans was marked used and removed from the group.',
|
||||
});
|
||||
expect(listGroupedStockEntriesMock).toHaveBeenCalledTimes(1);
|
||||
expect(listGroupedStockEntriesMock).toHaveBeenCalledWith(store, { expanded: 0 });
|
||||
expect(listGroupedStockEntriesMock).toHaveBeenCalledWith(store, { expanded: false });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -141,12 +141,12 @@ describe('stock list grouped-first behavior', () => {
|
||||
await data.init();
|
||||
|
||||
expect(data.viewMode).toBe('grouped');
|
||||
expect(listGroupedStockEntriesMock).toHaveBeenNthCalledWith(1, store, { expanded: 0 });
|
||||
expect(listGroupedStockEntriesMock).toHaveBeenNthCalledWith(1, store, { expanded: false });
|
||||
expect(listStockEntriesMock).not.toHaveBeenCalled();
|
||||
|
||||
await Promise.resolve();
|
||||
|
||||
expect(listGroupedStockEntriesMock).toHaveBeenNthCalledWith(2, store, { expanded: 1 });
|
||||
expect(listGroupedStockEntriesMock).toHaveBeenNthCalledWith(2, store, { expanded: true });
|
||||
|
||||
await data.switchView('items');
|
||||
expect(listStockEntriesMock).toHaveBeenCalledTimes(1);
|
||||
@@ -162,7 +162,7 @@ describe('stock list grouped-first behavior', () => {
|
||||
.mockResolvedValueOnce(createGroupedExpanded());
|
||||
|
||||
const data = stockListPageData({ isConnected: true, addAlert: vi.fn() });
|
||||
await data.loadGroupedEntries({ expanded: 0, resetVisible: true });
|
||||
await data.loadGroupedEntries({ expanded: false, resetVisible: true });
|
||||
|
||||
expect(data.groupDisplayItems(data.groupedEntries[0])).toEqual([]);
|
||||
expect(data.hasGroupedChildStubs(data.groupedEntries[0])).toBe(true);
|
||||
@@ -226,7 +226,7 @@ describe('stock list grouped-first behavior', () => {
|
||||
data.groupedLoaded = true;
|
||||
data.groupedEntries = createGroupedSummary().map((group) => data.indexGroup(group));
|
||||
|
||||
const pending = data.loadGroupedEntries({ expanded: 0, background: true });
|
||||
const pending = data.loadGroupedEntries({ expanded: false, background: true });
|
||||
|
||||
expect(data.state.isRefreshing).toBe(true);
|
||||
expect(data.groupedEntries).toHaveLength(1);
|
||||
|
||||
Reference in New Issue
Block a user