@@ -222,7 +222,8 @@ describe('Mapper', () => {
222222 } )
223223
224224 it ( 'complex object' , ( ) => {
225- type ObjType = { name : StringAttribute ; age : NumberAttribute ; children : ListAttribute }
225+
226+ interface ObjType { name : StringAttribute ; age : NumberAttribute ; children : ListAttribute }
226227 const attrValue = < MapAttribute < ObjType > > toDbOne ( {
227228 name : 'Max' ,
228229 age : 35 ,
@@ -738,7 +739,6 @@ describe('Mapper', () => {
738739 } )
739740
740741 describe ( 'from db' , ( ) => {
741- // FIXME TEST fix this test
742742 describe ( 'model with complex property values (decorators)' , ( ) => {
743743 let product : Product
744744
@@ -826,37 +826,46 @@ describe('Mapper', () => {
826826 expect ( Array . from ( cities ) [ 1 ] ) . toBe ( 'bern' )
827827 } )
828828
829- // it('awardWinningYears', () => {
830- // expect(organization.awardWinningYears).toBeDefined();
831- // expect(organization.awardWinningYears instanceof Set).toBeTruthy();
832- //
833- // const awardWinningYears: Set<number> = organization.awardWinningYears;
834- // expect(awardWinningYears.size).toBe(3);
835- // expect(Array.from(awardWinningYears)[0]).toBe(2002);
836- // expect(Array.from(awardWinningYears)[1]).toBe(2015);
837- // expect(Array.from(awardWinningYears)[2]).toBe(2017);
838- // });
839- //
840- // it('mixedList', () => {
841- // expect(organization.mixedList).toBeDefined();
842- // expect(Array.isArray(organization.mixedList)).toBeTruthy();
843- //
844- // const mixedList: any[] = organization.mixedList;
845- // expect(mixedList.length).toBe(3);
846- // expect(mixedList[0]).toBe('sample');
847- // expect(mixedList[1]).toBe(26);
848- // expect(mixedList[2]).toBe(true);
849- // });
850- //
851- // it('sortedSet', () => {
852- // expect(organization.setWithComplexSorted).toBeDefined();
853- // expect(organization.setWithComplexSorted instanceof Set).toBeTruthy();
854- //
855- // const sortedSet: Set<string> = organization.setWithComplexSorted;
856- // expect(sortedSet.size).toBe(2);
857- // expect(Array.from(sortedSet)[0]).toBe('1');
858- // expect(Array.from(sortedSet)[1]).toBe('2');
859- // });
829+ it ( 'birthdays' , ( ) => {
830+ expect ( organization . birthdays ) . toBeDefined ( )
831+ expect ( organization . birthdays instanceof Set ) . toBeTruthy ( )
832+
833+ const birthdays : Set < Birthday > = organization . birthdays
834+ expect ( birthdays . size ) . toBe ( 1 )
835+
836+ const birthday : Birthday = Array . from ( birthdays ) [ 0 ]
837+ expect ( birthday ) . toBeDefined ( )
838+ expect ( birthday . date ) . toEqual ( new Date ( '1958-04-13' ) )
839+ expect ( Array . isArray ( birthday . presents ) ) . toBeTruthy ( )
840+ } )
841+
842+
843+ it ( 'awards' , ( ) => {
844+ expect ( organization . awards ) . toBeDefined ( )
845+ expect ( organization . awards instanceof Set ) . toBeTruthy ( )
846+
847+ const awards = organization . awards
848+ expect ( awards . size ) . toBe ( 1 )
849+ const award = Array . from ( awards ) [ 0 ]
850+
851+ expect ( award ) . toBeDefined ( )
852+ expect ( award ) . toBe ( 'Best of Swiss Web' )
853+ } )
854+
855+ it ( 'events' , ( ) => {
856+ expect ( organization . events ) . toBeDefined ( )
857+ expect ( organization . events instanceof Set ) . toBeTruthy ( )
858+
859+ const events = organization . events
860+ expect ( events . size ) . toBe ( 1 )
861+
862+ const event = Array . from ( events ) [ 0 ]
863+
864+ expect ( event ) . toBeDefined ( )
865+ expect ( typeof event ) . toBe ( 'object' )
866+ expect ( event . name ) . toBe ( 'yearly get together' )
867+ expect ( event . participants ) . toBe ( 125 )
868+ } )
860869 } )
861870 } )
862871 } )
0 commit comments