@@ -173,8 +173,8 @@ describe('ConfigService', () => {
173173 expect ( result . host ) . toBe ( 'registry' ) ;
174174 } ) ;
175175
176- it ( 'should get banner' , async ( ) => {
177- const result = await service . getBanner ( ) ;
176+ it ( 'should get banner' , ( ) => {
177+ const result = service . getBanner ( ) ;
178178 expect ( result ) . toHaveProperty ( 'show' ) ;
179179 } ) ;
180180
@@ -199,9 +199,9 @@ describe('ConfigService', () => {
199199 expect ( result . status ) . toBe ( 'error' ) ;
200200 } ) ;
201201
202- it ( 'should update running config if setup enabled' , ( ) => {
202+ it ( 'should update running config if setup enabled' , async ( ) => {
203203 process . env . KUBERO_SETUP = 'enabled' ;
204- const result = service . updateRunningConfig (
204+ const result = await service . updateRunningConfig (
205205 'kube' ,
206206 'ctx' ,
207207 'ns' ,
@@ -213,9 +213,9 @@ describe('ConfigService', () => {
213213 expect ( kubectl . createNamespace ) . toHaveBeenCalled ( ) ;
214214 } ) ;
215215
216- it ( 'should return error if setup is disabled in updateRunningConfig' , ( ) => {
216+ it ( 'should return error if setup is disabled in updateRunningConfig' , async ( ) => {
217217 process . env . KUBERO_SETUP = 'disabled' ;
218- const result = service . updateRunningConfig (
218+ const result = await service . updateRunningConfig (
219219 'kube' ,
220220 'ctx' ,
221221 'ns' ,
@@ -298,8 +298,8 @@ describe('ConfigService', () => {
298298 });
299299 */
300300
301- it ( 'should get cluster issuer' , async ( ) => {
302- const result = await service . getClusterIssuer ( ) ;
301+ it ( 'should get cluster issuer' , ( ) => {
302+ const result = service . getClusterIssuer ( ) ;
303303 expect ( result . clusterissuer ) . toBe ( 'letsencrypt-prod' ) ;
304304 } ) ;
305305
@@ -439,7 +439,9 @@ describe('ConfigService', () => {
439439 } ) ;
440440
441441 it ( 'should handle database errors' , async ( ) => {
442- mockPrismaClient . runpack . findMany . mockRejectedValue ( new Error ( 'Database error' ) ) ;
442+ mockPrismaClient . runpack . findMany . mockRejectedValue (
443+ new Error ( 'Database error' ) ,
444+ ) ;
443445
444446 await expect ( service . getRunpacks ( ) ) . rejects . toThrow ( 'Database error' ) ;
445447 } ) ;
@@ -490,7 +492,9 @@ describe('ConfigService', () => {
490492 } ) ;
491493
492494 it ( 'should handle database errors' , async ( ) => {
493- mockPrismaClient . podSize . findMany . mockRejectedValue ( new Error ( 'Database error' ) ) ;
495+ mockPrismaClient . podSize . findMany . mockRejectedValue (
496+ new Error ( 'Database error' ) ,
497+ ) ;
494498
495499 await expect ( service . getPodSizes ( ) ) . rejects . toThrow ( 'Database error' ) ;
496500 } ) ;
@@ -622,7 +626,7 @@ describe('ConfigService', () => {
622626 expect ( result . description ) . toBe ( 'Large pod size' ) ;
623627 expect ( result . resources . requests ?. memory ) . toBe ( '512Mi' ) ;
624628 expect ( result . resources . limits ?. memory ) . toBe ( '1Gi' ) ;
625-
629+
626630 expect ( mockPrismaClient . podSize . create ) . toHaveBeenCalledWith ( {
627631 data : {
628632 name : 'large' ,
@@ -676,9 +680,13 @@ describe('ConfigService', () => {
676680 resources : { } ,
677681 } ) ;
678682
679- mockPrismaClient . podSize . create . mockRejectedValue ( new Error ( 'Database error' ) ) ;
683+ mockPrismaClient . podSize . create . mockRejectedValue (
684+ new Error ( 'Database error' ) ,
685+ ) ;
680686
681- await expect ( service . addPodSize ( mockPodSize ) ) . rejects . toThrow ( 'Database error' ) ;
687+ await expect ( service . addPodSize ( mockPodSize ) ) . rejects . toThrow (
688+ 'Database error' ,
689+ ) ;
682690 } ) ;
683691 } ) ;
684692
@@ -719,7 +727,7 @@ describe('ConfigService', () => {
719727 expect ( result . description ) . toBe ( 'Updated large pod size' ) ;
720728 expect ( result . resources . requests ?. memory ) . toBe ( '1Gi' ) ;
721729 expect ( result . resources . limits ?. memory ) . toBe ( '2Gi' ) ;
722-
730+
723731 expect ( mockPrismaClient . podSize . update ) . toHaveBeenCalledWith ( {
724732 where : { id : podSizeId } ,
725733 data : {
@@ -740,9 +748,13 @@ describe('ConfigService', () => {
740748 resources : { } ,
741749 } ) ;
742750
743- mockPrismaClient . podSize . update . mockRejectedValue ( new Error ( 'Database error' ) ) ;
751+ mockPrismaClient . podSize . update . mockRejectedValue (
752+ new Error ( 'Database error' ) ,
753+ ) ;
744754
745- await expect ( service . updatePodSize ( 'test-id' , mockPodSize ) ) . rejects . toThrow ( 'Database error' ) ;
755+ await expect (
756+ service . updatePodSize ( 'test-id' , mockPodSize ) ,
757+ ) . rejects . toThrow ( 'Database error' ) ;
746758 } ) ;
747759 } ) ;
748760
@@ -774,7 +786,7 @@ describe('ConfigService', () => {
774786 mockPrismaClient . podSize . findUnique . mockResolvedValue ( null ) ;
775787
776788 await expect ( service . deletePodSize ( podSizeId ) ) . rejects . toThrow (
777- `PodSize with id ${ podSizeId } not found`
789+ `PodSize with id ${ podSizeId } not found` ,
778790 ) ;
779791
780792 expect ( mockPrismaClient . podSize . delete ) . not . toHaveBeenCalled ( ) ;
@@ -785,9 +797,13 @@ describe('ConfigService', () => {
785797 const mockPodSize = { id : podSizeId , name : 'test' } ;
786798
787799 mockPrismaClient . podSize . findUnique . mockResolvedValue ( mockPodSize ) ;
788- mockPrismaClient . podSize . delete . mockRejectedValue ( new Error ( 'Database error' ) ) ;
800+ mockPrismaClient . podSize . delete . mockRejectedValue (
801+ new Error ( 'Database error' ) ,
802+ ) ;
789803
790- await expect ( service . deletePodSize ( podSizeId ) ) . rejects . toThrow ( 'Database error' ) ;
804+ await expect ( service . deletePodSize ( podSizeId ) ) . rejects . toThrow (
805+ 'Database error' ,
806+ ) ;
791807 } ) ;
792808 } ) ;
793809
@@ -819,7 +835,7 @@ describe('ConfigService', () => {
819835 runpackId,
820836 runpackName : 'nodejs-to-delete' ,
821837 } ,
822- } )
838+ } ) ,
823839 ) ;
824840 } ) ;
825841
@@ -829,7 +845,7 @@ describe('ConfigService', () => {
829845 mockPrismaClient . runpack . findUnique . mockResolvedValue ( null ) ;
830846
831847 await expect ( service . deleteRunpack ( runpackId ) ) . rejects . toThrow (
832- `Runpack with id ${ runpackId } not found`
848+ `Runpack with id ${ runpackId } not found` ,
833849 ) ;
834850
835851 expect ( mockPrismaClient . runpack . delete ) . not . toHaveBeenCalled ( ) ;
@@ -841,9 +857,13 @@ describe('ConfigService', () => {
841857 const mockRunpack = { id : runpackId , name : 'test-runpack' } ;
842858
843859 mockPrismaClient . runpack . findUnique . mockResolvedValue ( mockRunpack ) ;
844- mockPrismaClient . runpack . delete . mockRejectedValue ( new Error ( 'Database error' ) ) ;
860+ mockPrismaClient . runpack . delete . mockRejectedValue (
861+ new Error ( 'Database error' ) ,
862+ ) ;
845863
846- await expect ( service . deleteRunpack ( runpackId ) ) . rejects . toThrow ( 'Database error' ) ;
864+ await expect ( service . deleteRunpack ( runpackId ) ) . rejects . toThrow (
865+ 'Database error' ,
866+ ) ;
847867 } ) ;
848868 } ) ;
849869} ) ;
0 commit comments