This commit is contained in:
@@ -92,4 +92,28 @@ test('enqueues selected admin inventory pricing refreshes through the bulk API',
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch;
|
||||
}
|
||||
});
|
||||
|
||||
test('updates selected admin inventory tags through the bulk API', async () => {
|
||||
const originalFetch = globalThis.fetch;
|
||||
globalThis.fetch = async (url, options) => {
|
||||
assert.equal(url, '/api/v1/admin/bulk');
|
||||
assert.equal(options.method, 'POST');
|
||||
assert.deepEqual(JSON.parse(options.body), {
|
||||
action: 'TAGS',
|
||||
inventoryItemIds: ['item-1'],
|
||||
add: ['binder'],
|
||||
remove: [],
|
||||
});
|
||||
return { ok: true, async json() { return { data: [{ id: 'product-1', tags: ['binder'] }] }; } };
|
||||
};
|
||||
|
||||
try {
|
||||
const { updateAdminInventoryTags } = await import('../src/services/admin-catalog-service.js');
|
||||
assert.deepEqual(await updateAdminInventoryTags(['item-1'], ['binder'], [], 'csrf-token'), [
|
||||
{ id: 'product-1', tags: ['binder'] },
|
||||
]);
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch;
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user