test(e2e): full-chain stockOf читает остаток по складу (не агрегат)
Some checks are pending
Auto-tag / Create date-tag (push) Waiting to run
CI / Backend (.NET 8) (push) Waiting to run
CI / Web (React + Vite) (push) Waiting to run
CI / POS (WPF, Windows) (push) Waiting to run
Docker API / Build + push API (push) Waiting to run
Docker API / Deploy API on stage (push) Blocked by required conditions
Docker Web / Build + push Web (push) Waiting to run
Docker Web / Deploy Web on stage (push) Blocked by required conditions

После перехода остатков на агрегат «Все склады» при отсутствии storeId, stockOf
без storeId получал агрегатную строку (storeId=Guid.Empty) и не находил склад →
остатки читались как 0, что роняло приёмки/склад/инварианты. Теперь запрос с
storeId (+includeZero). full-chain снова 16/16 зелёный.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
nns 2026-10-09 10:23:49 +05:00
parent d380e186a8
commit 5a2ab4589c

View file

@ -130,9 +130,10 @@ async function maybeFailShot(ctx: Ctx, step: Step) {
;(step.screenshots ??= []).push({ rel: sh.rel, caption: `Состояние на падении ${step.id}` })
}
// helper: inventory stock for product (store-scoped)
// helper: inventory stock for product (store-scoped). Фильтруем по складу: без
// storeId список отдаёт агрегат «Все склады» (storeId = Guid.Empty), а не строку склада.
async function stockOf(api: AxiosInstance, storeId: string, productId: string): Promise<number> {
const r = await api.get(`/api/inventory/stock?productId=${productId}&pageSize=200`)
const r = await api.get(`/api/inventory/stock?productId=${productId}&storeId=${storeId}&includeZero=true&pageSize=200`)
if (r.status !== 200) return 0
const items = (r.data?.items ?? []) as { storeId?: string; quantity: number; productId: string }[]
const row = items.find((i) => i.storeId === storeId && i.productId === productId)