feat: reconcile application vertical slices
Backfill the completed acquisitions, sales, dashboard, pricing, search, public detail, worker, migration, contracts, validation, tests, and implementation-status changes into one verified application slice.
This commit is contained in:
@@ -1,21 +1,44 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
|
||||
import { createProviderMappingService } from '../../src/modules/pricing/services/provider-mapping-service.js';
|
||||
import { createProviderMappingService } from "../../src/modules/pricing/services/provider-mapping-service.js";
|
||||
|
||||
test('creates and disables seller-owned provider mappings', async () => {
|
||||
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' } }; },
|
||||
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');
|
||||
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",
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user