@@ -145,75 +145,75 @@ describe('BaseFirestoreRepository', () => {
145145 } ) ;
146146 } ) ;
147147
148- describe ( 'orderByDescending' , ( ) => {
149- it ( 'must order repository objects' , async ( ) => {
150- const bands = await bandRepository . orderByDescending ( 'formationYear' ) . find ( ) ;
151- expect ( bands [ 0 ] . id ) . toEqual ( 'porcupine-tree' ) ;
152- } ) ;
148+ describe ( 'orderByDescending' , ( ) => {
149+ it ( 'must order repository objects' , async ( ) => {
150+ const bands = await bandRepository . orderByDescending ( 'formationYear' ) . find ( ) ;
151+ expect ( bands [ 0 ] . id ) . toEqual ( 'porcupine-tree' ) ;
152+ } ) ;
153153
154- it ( 'must order the objects in a subcollection' , async ( ) => {
155- const pt = await bandRepository . findById ( 'porcupine-tree' ) ;
156- const albumsSubColl = pt . albums ;
157- const discographyNewestFirst = await albumsSubColl . orderByDescending ( 'releaseDate' ) . find ( ) ;
158- expect ( discographyNewestFirst [ 0 ] . id ) . toEqual ( 'fear-blank-planet' ) ;
159- } ) ;
154+ it ( 'must order the objects in a subcollection' , async ( ) => {
155+ const pt = await bandRepository . findById ( 'porcupine-tree' ) ;
156+ const albumsSubColl = pt . albums ;
157+ const discographyNewestFirst = await albumsSubColl . orderByDescending ( 'releaseDate' ) . find ( ) ;
158+ expect ( discographyNewestFirst [ 0 ] . id ) . toEqual ( 'fear-blank-planet' ) ;
159+ } ) ;
160160
161- it ( 'must be chainable with where* filters' , async ( ) => {
162- const pt = await bandRepository . findById ( 'porcupine-tree' ) ;
163- const albumsSubColl = pt . albums ;
164- const discographyNewestFirst = await albumsSubColl
165- . whereGreaterOrEqualThan ( 'releaseDate' , new Date ( '2001-01-01' ) )
166- . orderByDescending ( 'releaseDate' )
167- . find ( ) ;
168- expect ( discographyNewestFirst [ 0 ] . id ) . toEqual ( 'fear-blank-planet' ) ;
169- } ) ;
161+ it ( 'must be chainable with where* filters' , async ( ) => {
162+ const pt = await bandRepository . findById ( 'porcupine-tree' ) ;
163+ const albumsSubColl = pt . albums ;
164+ const discographyNewestFirst = await albumsSubColl
165+ . whereGreaterOrEqualThan ( 'releaseDate' , new Date ( '2001-01-01' ) )
166+ . orderByDescending ( 'releaseDate' )
167+ . find ( ) ;
168+ expect ( discographyNewestFirst [ 0 ] . id ) . toEqual ( 'fear-blank-planet' ) ;
169+ } ) ;
170170
171- it ( 'must be chainable with limit' , async ( ) => {
172- const bands = await bandRepository . orderByDescending ( 'formationYear' ) . limit ( 2 ) . find ( ) ;
173- const lastBand = bands [ bands . length - 1 ] ;
174- expect ( lastBand . id ) . toEqual ( 'red-hot-chili-peppers' ) ;
175- } ) ;
171+ it ( 'must be chainable with limit' , async ( ) => {
172+ const bands = await bandRepository . orderByDescending ( 'formationYear' ) . limit ( 2 ) . find ( ) ;
173+ const lastBand = bands [ bands . length - 1 ] ;
174+ expect ( lastBand . id ) . toEqual ( 'red-hot-chili-peppers' ) ;
175+ } ) ;
176176
177- it ( 'must throw an Error if an orderBy* function is called more than once in the same expression' , async ( ) => {
178- const pt = await bandRepository . findById ( 'porcupine-tree' ) ;
179- const albumsSubColl = pt . albums ;
180- expect ( ( ) => {
181- albumsSubColl . orderByAscending ( 'releaseDate' ) . orderByDescending ( 'releaseDate' ) ;
182- } ) . toThrow ( ) ;
183- } ) ;
177+ it ( 'must throw an Error if an orderBy* function is called more than once in the same expression' , async ( ) => {
178+ const pt = await bandRepository . findById ( 'porcupine-tree' ) ;
179+ const albumsSubColl = pt . albums ;
180+ expect ( ( ) => {
181+ albumsSubColl . orderByAscending ( 'releaseDate' ) . orderByDescending ( 'releaseDate' ) ;
182+ } ) . toThrow ( ) ;
183+ } ) ;
184184
185- it ( 'must throw an Error if an orderBy* function is called more than once in the same expression descending' , async ( ) => {
186- const pt = await bandRepository . findById ( 'porcupine-tree' ) ;
187- const albumsSubColl = pt . albums ;
188- expect ( ( ) => {
189- albumsSubColl . orderByDescending ( 'releaseDate' ) . orderByDescending ( 'releaseDate' ) ;
190- } ) . toThrow ( ) ;
191- } ) ;
185+ it ( 'must throw an Error if an orderBy* function is called more than once in the same expression descending' , async ( ) => {
186+ const pt = await bandRepository . findById ( 'porcupine-tree' ) ;
187+ const albumsSubColl = pt . albums ;
188+ expect ( ( ) => {
189+ albumsSubColl . orderByDescending ( 'releaseDate' ) . orderByDescending ( 'releaseDate' ) ;
190+ } ) . toThrow ( ) ;
191+ } ) ;
192192
193- it ( 'must succeed when orderBy* function is called more than once in the same expression with different fields' , async ( ) => {
194- const pt = await bandRepository . findById ( 'porcupine-tree' ) ;
195- const albumsSubColl = pt . albums ;
196- expect ( ( ) => {
197- albumsSubColl . orderByAscending ( 'releaseDate' ) . orderByDescending ( 'name' ) ;
198- } ) . not . toThrow ( ) ;
199- } ) ;
193+ it ( 'must succeed when orderBy* function is called more than once in the same expression with different fields' , async ( ) => {
194+ const pt = await bandRepository . findById ( 'porcupine-tree' ) ;
195+ const albumsSubColl = pt . albums ;
196+ expect ( ( ) => {
197+ albumsSubColl . orderByAscending ( 'releaseDate' ) . orderByDescending ( 'name' ) ;
198+ } ) . not . toThrow ( ) ;
199+ } ) ;
200200
201- it ( 'must succeed when orderBy* function is called more than once in the same expression with different fields ascending' , async ( ) => {
202- const pt = await bandRepository . findById ( 'porcupine-tree' ) ;
203- const albumsSubColl = pt . albums ;
204- expect ( ( ) => {
205- albumsSubColl . orderByAscending ( 'releaseDate' ) . orderByAscending ( 'name' ) ;
206- } ) . not . toThrow ( ) ;
207- } ) ;
201+ it ( 'must succeed when orderBy* function is called more than once in the same expression with different fields ascending' , async ( ) => {
202+ const pt = await bandRepository . findById ( 'porcupine-tree' ) ;
203+ const albumsSubColl = pt . albums ;
204+ expect ( ( ) => {
205+ albumsSubColl . orderByAscending ( 'releaseDate' ) . orderByAscending ( 'name' ) ;
206+ } ) . not . toThrow ( ) ;
207+ } ) ;
208208
209- it ( 'must succeed when orderBy* function is called more than once in the same expression with different fields descending' , async ( ) => {
210- const pt = await bandRepository . findById ( 'porcupine-tree' ) ;
211- const albumsSubColl = pt . albums ;
212- expect ( ( ) => {
213- albumsSubColl . orderByDescending ( 'releaseDate' ) . orderByDescending ( 'name' ) ;
214- } ) . not . toThrow ( ) ;
215- } ) ;
209+ it ( 'must succeed when orderBy* function is called more than once in the same expression with different fields descending' , async ( ) => {
210+ const pt = await bandRepository . findById ( 'porcupine-tree' ) ;
211+ const albumsSubColl = pt . albums ;
212+ expect ( ( ) => {
213+ albumsSubColl . orderByDescending ( 'releaseDate' ) . orderByDescending ( 'name' ) ;
214+ } ) . not . toThrow ( ) ;
216215 } ) ;
216+ } ) ;
217217
218218 describe ( 'findById' , ( ) => {
219219 it ( 'must find by id' , async ( ) => {
0 commit comments