File tree Expand file tree Collapse file tree 3 files changed +38
-0
lines changed
Expand file tree Collapse file tree 3 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ latitudeShApi.Profile.get().then((response) => {
4848- ` Plans.get ` . Params: ` (planId, searchParams) ` . [ Reference] ( https://docs.latitude.sh/reference/get-plan )
4949- ` Plans.list ` . Params: ` (searchParams) ` . [ Reference] ( https://docs.latitude.sh/reference/get-plans )
5050- ` Plans.operatingSystems ` . Params: ` (searchParams) ` . [ Reference] ( https://docs.latitude.sh/reference/get-plans-operating-system )
51+ - ` Plans.storage ` . Params: ` (searchParams) ` . [ Reference] ( https://docs.latitude.sh/reference/get-storage-plans )
5152
5253- ` Projects.Members.list ` . Params: ` (projectIdOrSlug, searchParams) ` . [ Reference] ( https://docs.latitude.sh/reference/get-team-members )
5354
Original file line number Diff line number Diff line change @@ -42,6 +42,15 @@ class Plans {
4242 searchParams
4343 ) ;
4444 }
45+
46+ storage ( searchParams = '' ) {
47+ searchParams = new URLSearchParams ( searchParams ) . toString ( ) ;
48+ return this . LatitudeSh . _get (
49+ '/plans/storage' ,
50+ this . LatitudeSh . _headers ,
51+ searchParams
52+ ) ;
53+ }
4554}
4655
4756module . exports = LatitudeSh => {
Original file line number Diff line number Diff line change @@ -109,3 +109,31 @@ describe('get operating systems', () => {
109109 } ) ;
110110 } ) ;
111111} ) ;
112+
113+ describe ( 'get storage' , ( ) => {
114+ it ( 'call get request with right params' , async ( ) => {
115+ const path = '/plans/storage' ;
116+ LatitudeSh . _get = jest . fn ( ( ) => {
117+ return {
118+ body : {
119+ success : true ,
120+ } ,
121+ } ;
122+ } ) ;
123+ LatitudeShApi . Plans . storage ( searchParams ) ;
124+ await expect ( LatitudeSh . _get ) . toHaveBeenCalledWith (
125+ path ,
126+ LatitudeSh . _headers ,
127+ searchParamsParsed
128+ ) ;
129+ } ) ;
130+
131+ it ( 'call get request with wrong params' , async ( ) => {
132+ const path = '/plans/storage' ;
133+ const error = new Error ( 'Async error' ) ;
134+ LatitudeSh . _get = jest . fn ( ) . mockRejectedValue ( error ) ;
135+ await LatitudeShApi . Plans . storage ( ) . catch ( e => {
136+ expect ( e ) . toBe ( error ) ;
137+ } ) ;
138+ } ) ;
139+ } ) ;
You can’t perform that action at this time.
0 commit comments