ddd-tool-kit
Version:
A development tool kit for using Domain Driven Design in your Web API Node.js
24 lines (23 loc) • 1.28 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const ip_value_object_1 = require("../../implementations/value-objects/ip/ip.value-object");
const session_entity_1 = require("../../implementations/entities/session/session.entity");
const verify_all_props_exists_util_1 = require("./verify-all-props-exists.util");
describe('verify-all-props.exists.util.spec', () => {
it('should be return true if all props exists', () => {
const sessionIp = ip_value_object_1.IpValueObject.init({ value: '139.205.112.175' })
.result;
const entity = session_entity_1.SessionEntity.init({ ip: sessionIp })
.result;
const propNames = ['id', 'ip', 'loggedAt', 'expiresAt'];
const allPropsExists = (0, verify_all_props_exists_util_1.verifyAllPropsExists)(propNames, entity);
expect(allPropsExists).toBeTruthy();
});
it('should be return false if some prop is not exists', () => {
const entity = session_entity_1.SessionEntity.init({})
.result;
const propNames = ['id', 'ip', 'loggedAt', 'expiresAt'];
const allPropsExists = (0, verify_all_props_exists_util_1.verifyAllPropsExists)(propNames, entity);
expect(allPropsExists).toBeFalsy();
});
});