This commit is contained in:
@@ -182,3 +182,38 @@ test("lists jobs and retries a failed job with CSRF protection", async (testCont
|
||||
assert.equal(retryResponse.statusCode, 202);
|
||||
assert.equal(csrfChecks, 1);
|
||||
});
|
||||
|
||||
test("lists seller-scoped latest market valuations", async (testContext) => {
|
||||
const app = buildApp({
|
||||
authenticateAdmin: async () => ({ sellerId: "seller-1" }),
|
||||
pricingService: {
|
||||
async listValuations({ sellerId }) {
|
||||
assert.equal(sellerId, "seller-1");
|
||||
return [
|
||||
{
|
||||
id: "valuation-1",
|
||||
inventoryItemId: "item-1",
|
||||
valueMinor: 2500,
|
||||
currency: "USD",
|
||||
strategy: "MEDIAN",
|
||||
confidence: "MEDIUM",
|
||||
sourceCount: 2,
|
||||
calculatedAt: new Date().toISOString(),
|
||||
},
|
||||
];
|
||||
},
|
||||
},
|
||||
});
|
||||
testContext.after(() => app.close());
|
||||
|
||||
const response = await app.inject({
|
||||
method: "GET",
|
||||
url: "/api/v1/admin/valuations",
|
||||
});
|
||||
|
||||
assert.equal(response.statusCode, 200);
|
||||
const [valuation] = response.json().data;
|
||||
assert.equal(valuation.inventoryItemId, "item-1");
|
||||
assert.equal(valuation.valueMinor, 2500);
|
||||
assert.equal(valuation.stale, false);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user