UNPKG

miter

Version:

A typescript web framework based on ExpressJs based loosely on SailsJs

47 lines 2.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const chai_1 = require("chai"); const sinonChai = require("sinon-chai"); chai_1.use(sinonChai); const orm_transform_service_1 = require("../orm-transform.service"); describe('OrmTransformService', () => { let instance; before(() => instance = new orm_transform_service_1.OrmTransformService()); describe('.transformModel', () => { it('should not modify the model metadata', () => { chai_1.expect(instance.transformModel({})).to.deep.eq({}); }); }); describe('.transformModelName', () => { it('should not modify the model name', () => { chai_1.expect(instance.transformModelName('User')).to.be.null; }); }); describe('.transformColumn', () => { it('should not modify the column metadata', () => { chai_1.expect(instance.transformColumn({})).to.deep.eq({}); }); }); describe('.transformColumnName', () => { it('should not modify the column name', () => { chai_1.expect(instance.transformColumnName('isPublished')).to.be.null; }); }); describe('.transformAssociation', () => { it('should not modify the column metadata', () => { chai_1.expect(instance.transformAssociation({})).to.deep.eq({}); }); }); describe('.transformAssociationColumnName', () => { it('should return null if the column name is falsey', () => { chai_1.expect(instance.transformAssociationColumnName(null)).to.be.null; chai_1.expect(instance.transformAssociationColumnName('')).to.be.null; }); it('should append Id if the column name is not falsey', () => { chai_1.expect(instance.transformAssociationColumnName('ownerUser')).to.eq('ownerUserId'); chai_1.expect(instance.transformAssociationColumnName('projectReadme')).to.eq('projectReadmeId'); chai_1.expect(instance.transformAssociationColumnName('forkedProject')).to.eq('forkedProjectId'); }); }); }); //# sourceMappingURL=orm-transform.service.spec.js.map