@@ -27,21 +27,36 @@ describe('CloudComponent Storage Quota', () => {
2727 ] ) ;
2828
2929 cloudServiceSpy . getRootFolder . and . returnValue (
30- of ( { name : 'Root' , path : '/' , folders : [ ] , files : [ ] , lastModifiedAt : 0 } )
30+ of ( {
31+ name : 'Root' ,
32+ path : '/' ,
33+ folders : [ ] ,
34+ files : [ ] ,
35+ lastModifiedAt : 0 ,
36+ } ) ,
3137 ) ;
3238 cloudServiceSpy . getFolderContent . and . returnValue (
33- of ( { content : [ ] , totalElements : 0 , totalPages : 1 , pageNumber : 0 , pageSize : 50 } )
39+ of ( {
40+ content : [ ] ,
41+ totalElements : 0 ,
42+ totalPages : 1 ,
43+ pageNumber : 0 ,
44+ pageSize : 50 ,
45+ } ) ,
3446 ) ;
3547 cloudServiceSpy . getStorageQuota . and . returnValue (
36- of ( { usedBytes : 500 , totalBytes : 1000 } )
48+ of ( { usedBytes : 500 , totalBytes : 1000 } ) ,
3749 ) ;
3850
3951 await TestBed . configureTestingModule ( {
4052 imports : [ CloudComponent ] ,
4153 providers : [
4254 { provide : CloudService , useValue : cloudServiceSpy } ,
4355 { provide : UiToastService , useValue : toastSpy } ,
44- { provide : Router , useValue : { navigate : jasmine . createSpy ( 'navigate' ) } } ,
56+ {
57+ provide : Router ,
58+ useValue : { navigate : jasmine . createSpy ( 'navigate' ) } ,
59+ } ,
4560 ConfirmationService ,
4661 ] ,
4762 } ) . compileComponents ( ) ;
@@ -52,7 +67,10 @@ describe('CloudComponent Storage Quota', () => {
5267
5368 it ( 'should initialize and load storage quota' , ( ) => {
5469 fixture . detectChanges ( ) ;
55- expect ( component . storageQuota ) . toEqual ( { usedBytes : 500 , totalBytes : 1000 } ) ;
70+ expect ( component . storageQuota ) . toEqual ( {
71+ usedBytes : 500 ,
72+ totalBytes : 1000 ,
73+ } ) ;
5674 expect ( component . quotaPercentage ) . toBe ( 50 ) ;
5775 expect ( component . usedSpaceLabel ) . toBe ( '500 Bytes' ) ;
5876 expect ( component . totalSpaceLabel ) . toBe ( '1000 Bytes' ) ;
@@ -75,27 +93,34 @@ describe('CloudComponent Storage Quota', () => {
7593 expect (
7694 component . isQuotaExceededError ( {
7795 error : { message : 'Storage quota exceeded' } ,
78- } )
96+ } ) ,
7997 ) . toBeTrue ( ) ;
8098 expect (
8199 component . isQuotaExceededError ( {
82100 message : 'User is out of space' ,
83- } )
101+ } ) ,
84102 ) . toBeTrue ( ) ;
85- expect ( component . isQuotaExceededError ( { status : 400 , message : 'Invalid format' } ) ) . toBeFalse ( ) ;
103+ expect (
104+ component . isQuotaExceededError ( {
105+ status : 400 ,
106+ message : 'Invalid format' ,
107+ } ) ,
108+ ) . toBeFalse ( ) ;
86109 } ) ;
87110
88111 it ( 'should show specific toast error on quota-exceeded upload rejection' , ( ) => {
89- const mockFile = new File ( [ 'test content' ] , 'test.txt' , { type : 'text/plain' } ) ;
112+ const mockFile = new File ( [ 'test content' ] , 'test.txt' , {
113+ type : 'text/plain' ,
114+ } ) ;
90115 cloudServiceSpy . uploadFile . and . returnValue (
91- throwError ( ( ) => ( { status : 413 , error : { message : 'Quota exceeded' } } ) )
116+ throwError ( ( ) => ( { status : 413 , error : { message : 'Quota exceeded' } } ) ) ,
92117 ) ;
93118
94119 component . uploadFile ( '/' , mockFile ) ;
95120
96121 expect ( toastSpy . error ) . toHaveBeenCalledWith (
97122 'Storage quota exceeded' ,
98- jasmine . stringMatching ( / q u o t a h a s b e e n r e a c h e d / )
123+ jasmine . stringMatching ( / q u o t a h a s b e e n r e a c h e d / ) ,
99124 ) ;
100125 } ) ;
101126} ) ;
0 commit comments