domain-objects
Version:
A simple, convenient way to represent domain objects, leverage domain knowledge, and add runtime validation in your code base.
51 lines • 1.84 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const getDomainObjectNameAfterDroppingSomeQualifiers_1 = require("./getDomainObjectNameAfterDroppingSomeQualifiers");
describe('getDomainObjectNameAfterDroppingSomeQualifiers', () => {
const cases = [
{
domainObjectName: 'HomeAddress',
qualifiersToDrop: 1,
expectedResult: 'Address',
},
{
domainObjectName: 'HomeAddress',
qualifiersToDrop: 2,
expectedResult: null,
},
{
domainObjectName: 'PlaceExternalId',
qualifiersToDrop: 1,
expectedResult: 'ExternalId',
},
{
domainObjectName: 'PlaceExternalId',
qualifiersToDrop: 2,
expectedResult: null,
},
{
domainObjectName: 'TrainStationDockingGate',
qualifiersToDrop: 2,
expectedResult: 'DockingGate',
},
{
domainObjectName: 'TrainStationDockingGate',
qualifiersToDrop: 3,
expectedResult: 'Gate',
},
{
domainObjectName: 'TrainStationDockingGate',
qualifiersToDrop: 4,
expectedResult: null,
},
];
cases.forEach((testCase) => {
it(`should return ${testCase.expectedResult} for ${testCase.domainObjectName}, ${testCase.qualifiersToDrop}`, () => {
expect((0, getDomainObjectNameAfterDroppingSomeQualifiers_1.getDomainObjectNameAfterDroppingSomeQualifiers)({
domainObjectName: testCase.domainObjectName,
qualifiersToDrop: testCase.qualifiersToDrop,
})).toEqual(testCase.expectedResult);
});
});
});
//# sourceMappingURL=getDomainObjectNameAfterDroppingSomeQualifiers.test.js.map