Refactor stock API to replace numeric flags with boolean values, add getItemLabel endpoint, and update tests/documentation
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2026-05-01 23:51:05 +02:00
parent 34e339eb44
commit 1fe56a232b
12 changed files with 193 additions and 47 deletions
+4 -4
View File
@@ -61,12 +61,12 @@ describe('api/client', () => {
const url = buildKitchenApiUrl(store, 'kitchen/items/grouped', {
search_name: 'Milk + eggs',
expanded: 1,
expanded: true,
ignored: '',
});
expect(url).toBe(
'https://api.example.com/my%20db/kitchen/items/grouped?search_name=Milk+%2B+eggs&expanded=1',
'https://api.example.com/my%20db/kitchen/items/grouped?search_name=Milk+%2B+eggs&expanded=true',
);
});
@@ -88,14 +88,14 @@ describe('api/client', () => {
name: 'Rice',
},
query: {
label: 1,
label: true,
},
});
expect(payload).toEqual({ ok: true });
const [url, request] = fetchSpy.mock.calls[0];
expect(url).toBe('/kitchen-db/kitchen/items?label=1');
expect(url).toBe('/kitchen-db/kitchen/items?label=true');
expect(request.method).toBe('POST');
expect(request.body).toBe('{"name":"Rice"}');
expect(request.headers.get('Accept')).toBe('application/json');