Backfill the completed acquisitions, sales, dashboard, pricing, search, public detail, worker, migration, contracts, validation, tests, and implementation-status changes into one verified application slice.
45 lines
1.3 KiB
JavaScript
45 lines
1.3 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
|
|
import { createProviderMappingService } from "../../src/modules/pricing/services/provider-mapping-service.js";
|
|
|
|
test("creates and disables seller-owned provider mappings", async () => {
|
|
const calls = [];
|
|
const service = createProviderMappingService({
|
|
providerMappingRepository: {
|
|
async createForSeller(input, sellerId) {
|
|
calls.push(["create", input, sellerId]);
|
|
return { status: "CREATED", mapping: { id: "mapping-1", ...input } };
|
|
},
|
|
async listForSeller() {
|
|
return [{ id: "mapping-1", status: "ACTIVE" }];
|
|
},
|
|
async disableForSeller() {
|
|
return {
|
|
status: "DISABLED",
|
|
mapping: { id: "mapping-1", status: "DISABLED" },
|
|
};
|
|
},
|
|
},
|
|
});
|
|
|
|
const created = await service.create({
|
|
sellerId: "seller-1",
|
|
productId: "product-1",
|
|
providerId: "fixture",
|
|
mappingType: "PRODUCT",
|
|
externalIdentifier: "ext-1",
|
|
});
|
|
assert.equal(created.id, "mapping-1");
|
|
assert.equal(calls[0][2], "seller-1");
|
|
assert.equal(
|
|
(await service.list({ sellerId: "seller-1", productId: "product-1" }))
|
|
.length,
|
|
1,
|
|
);
|
|
assert.equal(
|
|
(await service.disable({ sellerId: "seller-1", id: "mapping-1" })).status,
|
|
"DISABLED",
|
|
);
|
|
});
|