feat(appointment): integrate work calendar and stable cargo batches
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { contractViolations } from './analyze-firstleg-dependencies.mjs';
|
||||
import path from 'node:path';
|
||||
import test from 'node:test';
|
||||
|
||||
@@ -7,6 +9,17 @@ const moduleRoot = path.resolve(import.meta.dirname, '..');
|
||||
const analyzer = path.join(moduleRoot, 'scripts', 'analyze-firstleg-dependencies.mjs');
|
||||
const contract = path.join(moduleRoot, 'src', 'test', 'resources', 'architecture', 'firstleg-slice-dependencies.json');
|
||||
|
||||
test('reviewed original-domain calls do not open an entire slice or allow wildcard grants', () => {
|
||||
const report=analyze(); const baseline=JSON.parse(readFileSync(contract,'utf8'));
|
||||
assert.deepEqual(contractViolations(report,baseline),[]);
|
||||
report.classDependencies.push({source:'com.baiyue.firstleg.service.SmartLoadingService',target:'com.baiyue.firstleg.domain.PriceBookChannelCatalog'});
|
||||
assert.ok(contractViolations(report,baseline).some(message=>message.includes('SmartLoadingService->com.baiyue.firstleg.domain.PriceBookChannelCatalog')));
|
||||
baseline.reviewedClassDependencies.push({source:'com.baiyue.firstleg.*',target:'com.baiyue.firstleg.service.FbaPricingService',reason:'invalid wildcard'});
|
||||
assert.ok(contractViolations(report,baseline).some(message=>message.includes('exact classes')));
|
||||
report.packageSccs.push(['com.baiyue.firstleg.service','com.baiyue.firstleg.pricebookquery.application']);
|
||||
assert.ok(contractViolations(report,baseline).some(message=>message.includes('unreviewed package cycle')));
|
||||
});
|
||||
|
||||
function analyze() {
|
||||
return JSON.parse(execFileSync(process.execPath, [analyzer, '--source-set', 'main', '--format', 'json'], {
|
||||
cwd: moduleRoot,
|
||||
@@ -53,7 +66,7 @@ test('customer statistics application layer only depends inward', () => {
|
||||
assert.deepEqual(outwardDependencies, []);
|
||||
});
|
||||
|
||||
test('price book query is a leaf slice and removes the package cycle', () => {
|
||||
test('price book query remains a leaf slice outside reviewed pre-existing package cycles', () => {
|
||||
const report = analyze();
|
||||
const classes = report.classes.filter(entry => entry.slice === 'pricebook-query');
|
||||
assert.deepEqual(classes.map(entry => entry.fqcn).sort(), [
|
||||
@@ -67,7 +80,9 @@ test('price book query is a leaf slice and removes the package cycle', () => {
|
||||
assert.deepEqual(report.sliceEdges.filter(edge => edge.target === 'pricebook-query')
|
||||
.map(edge => edge.source).sort(), ['booking-customs-trucking', 'measurement-pricing', 'split-loading']);
|
||||
assert.equal(report.sliceSccs.some(component => component.includes('pricebook-query')), false);
|
||||
assert.deepEqual(report.packageSccs, []);
|
||||
assert.equal(report.packageSccs.some(cycle=>cycle.some(pkg=>pkg.startsWith('com.baiyue.firstleg.pricebookquery'))),false);
|
||||
const reviewed=JSON.parse(readFileSync(contract,'utf8')).reviewedPackageCycles.map(c=>c.packages);
|
||||
assert.deepEqual(report.packageSccs,reviewed);
|
||||
});
|
||||
|
||||
test('price book query application and consumers respect ports', () => {
|
||||
|
||||
Reference in New Issue
Block a user