This commit is contained in:
@@ -113,6 +113,34 @@ test('enqueues pricing refresh jobs for owned inventory items', async () => {
|
||||
assert.deepEqual(jobs, [{ id: 'job-1', status: 'PENDING' }]);
|
||||
});
|
||||
|
||||
test('updates Product tags for selected owned inventory items', async () => {
|
||||
const updates = [];
|
||||
const service = createInventoryItemService({
|
||||
productRepository: { async findById() { return null; } },
|
||||
conditionRepository: { async findById() { return null; } },
|
||||
inventoryItemRepository: {
|
||||
async listBySellerId() {
|
||||
return [
|
||||
{ id: 'item-1', productId: 'product-1', conditionId: 'condition-1' },
|
||||
{ id: 'item-2', productId: 'product-1', conditionId: 'condition-1' },
|
||||
];
|
||||
},
|
||||
async updateProductTagsByIdsForSeller(...input) {
|
||||
updates.push(input);
|
||||
return [{ id: 'product-1', tags: ['binder', 'keep'] }];
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
assert.deepEqual(await service.updateTagsMany({
|
||||
inventoryItemIds: ['item-1', 'item-2'],
|
||||
sellerId: 'seller-id',
|
||||
addTags: ['Binder'],
|
||||
removeTags: ['sell'],
|
||||
}), [{ id: 'product-1', tags: ['binder', 'keep'] }]);
|
||||
assert.deepEqual(updates, [[['item-1', 'item-2'], 'seller-id', ['Binder'], ['sell']]]);
|
||||
});
|
||||
|
||||
test('rejects conditions from another category', async () => {
|
||||
const service = createService({
|
||||
product: { id: 'product-id', sellerId: 'seller-id', categoryId: 'cards' },
|
||||
|
||||
Reference in New Issue
Block a user