fix(front) : pagination par defaut a 25 sur les repertoires (ERP-193)
This commit is contained in:
@@ -25,8 +25,8 @@ function makeHydra(total: number): HydraCollection<Client> {
|
|||||||
describe('useClientsRepository', () => {
|
describe('useClientsRepository', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mockGet.mockReset()
|
mockGet.mockReset()
|
||||||
// 25 items → 3 pages a 10/page : permet de tester la navigation page 2.
|
// 60 items → 3 pages a 25/page : permet de tester la navigation page 2.
|
||||||
mockGet.mockResolvedValue(makeHydra(25))
|
mockGet.mockResolvedValue(makeHydra(60))
|
||||||
})
|
})
|
||||||
|
|
||||||
it('cible la ressource /clients en page 1 par defaut', async () => {
|
it('cible la ressource /clients en page 1 par defaut', async () => {
|
||||||
@@ -35,7 +35,7 @@ describe('useClientsRepository', () => {
|
|||||||
|
|
||||||
expect(mockGet).toHaveBeenLastCalledWith(
|
expect(mockGet).toHaveBeenLastCalledWith(
|
||||||
'/clients',
|
'/clients',
|
||||||
{ page: 1, itemsPerPage: 10 },
|
{ page: 1, itemsPerPage: 25 },
|
||||||
expect.objectContaining({ toast: false }),
|
expect.objectContaining({ toast: false }),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@@ -65,7 +65,7 @@ describe('useClientsRepository', () => {
|
|||||||
'siteId[]': ['1', '2'],
|
'siteId[]': ['1', '2'],
|
||||||
archivedOnly: true,
|
archivedOnly: true,
|
||||||
page: 1,
|
page: 1,
|
||||||
itemsPerPage: 10,
|
itemsPerPage: 25,
|
||||||
},
|
},
|
||||||
expect.objectContaining({ toast: false }),
|
expect.objectContaining({ toast: false }),
|
||||||
)
|
)
|
||||||
@@ -78,7 +78,7 @@ describe('useClientsRepository', () => {
|
|||||||
|
|
||||||
expect(mockGet).toHaveBeenLastCalledWith(
|
expect(mockGet).toHaveBeenLastCalledWith(
|
||||||
'/clients',
|
'/clients',
|
||||||
{ page: 1, itemsPerPage: 10 },
|
{ page: 1, itemsPerPage: 25 },
|
||||||
expect.objectContaining({ toast: false }),
|
expect.objectContaining({ toast: false }),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ function makeHydra(total: number): HydraCollection<Supplier> {
|
|||||||
describe('useSuppliersRepository', () => {
|
describe('useSuppliersRepository', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mockGet.mockReset()
|
mockGet.mockReset()
|
||||||
// 25 items → 3 pages a 10/page : permet de tester la navigation page 2.
|
// 60 items → 3 pages a 25/page : permet de tester la navigation page 2.
|
||||||
mockGet.mockResolvedValue(makeHydra(25))
|
mockGet.mockResolvedValue(makeHydra(60))
|
||||||
})
|
})
|
||||||
|
|
||||||
it('cible la ressource /suppliers en page 1 par defaut', async () => {
|
it('cible la ressource /suppliers en page 1 par defaut', async () => {
|
||||||
@@ -35,7 +35,7 @@ describe('useSuppliersRepository', () => {
|
|||||||
|
|
||||||
expect(mockGet).toHaveBeenLastCalledWith(
|
expect(mockGet).toHaveBeenLastCalledWith(
|
||||||
'/suppliers',
|
'/suppliers',
|
||||||
{ page: 1, itemsPerPage: 10 },
|
{ page: 1, itemsPerPage: 25 },
|
||||||
expect.objectContaining({ toast: false }),
|
expect.objectContaining({ toast: false }),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@@ -65,7 +65,7 @@ describe('useSuppliersRepository', () => {
|
|||||||
'siteId[]': ['86', '17'],
|
'siteId[]': ['86', '17'],
|
||||||
archivedOnly: true,
|
archivedOnly: true,
|
||||||
page: 1,
|
page: 1,
|
||||||
itemsPerPage: 10,
|
itemsPerPage: 25,
|
||||||
},
|
},
|
||||||
expect.objectContaining({ toast: false }),
|
expect.objectContaining({ toast: false }),
|
||||||
)
|
)
|
||||||
@@ -78,7 +78,7 @@ describe('useSuppliersRepository', () => {
|
|||||||
|
|
||||||
expect(mockGet).toHaveBeenLastCalledWith(
|
expect(mockGet).toHaveBeenLastCalledWith(
|
||||||
'/suppliers',
|
'/suppliers',
|
||||||
{ page: 1, itemsPerPage: 10 },
|
{ page: 1, itemsPerPage: 25 },
|
||||||
expect.objectContaining({ toast: false }),
|
expect.objectContaining({ toast: false }),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -49,5 +49,6 @@ export interface Client {
|
|||||||
* gerer.
|
* gerer.
|
||||||
*/
|
*/
|
||||||
export function useClientsRepository() {
|
export function useClientsRepository() {
|
||||||
return usePaginatedList<Client>({ url: '/clients' })
|
// Pagination par defaut a 25 sur le repertoire (retour metier ERP-193).
|
||||||
|
return usePaginatedList<Client>({ url: '/clients', defaultItemsPerPage: 25 })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,5 +51,6 @@ export interface Supplier {
|
|||||||
* `usePaginatedList`. Aucun reset au logout a gerer.
|
* `usePaginatedList`. Aucun reset au logout a gerer.
|
||||||
*/
|
*/
|
||||||
export function useSuppliersRepository() {
|
export function useSuppliersRepository() {
|
||||||
return usePaginatedList<Supplier>({ url: '/suppliers' })
|
// Pagination par defaut a 25 sur le repertoire (retour metier ERP-193).
|
||||||
|
return usePaginatedList<Supplier>({ url: '/suppliers', defaultItemsPerPage: 25 })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ describe('useProvidersRepository', () => {
|
|||||||
expect(mockApiGet).toHaveBeenCalledTimes(1)
|
expect(mockApiGet).toHaveBeenCalledTimes(1)
|
||||||
const [url, query, opts] = mockApiGet.mock.calls[0]
|
const [url, query, opts] = mockApiGet.mock.calls[0]
|
||||||
expect(url).toBe('/providers')
|
expect(url).toBe('/providers')
|
||||||
expect(query).toMatchObject({ page: 1, itemsPerPage: 10 })
|
expect(query).toMatchObject({ page: 1, itemsPerPage: 25 })
|
||||||
expect(opts).toMatchObject({
|
expect(opts).toMatchObject({
|
||||||
toast: false,
|
toast: false,
|
||||||
headers: { Accept: 'application/ld+json' },
|
headers: { Accept: 'application/ld+json' },
|
||||||
|
|||||||
@@ -59,5 +59,6 @@ export interface Provider {
|
|||||||
* `usePaginatedList`. Aucun reset au logout a gerer.
|
* `usePaginatedList`. Aucun reset au logout a gerer.
|
||||||
*/
|
*/
|
||||||
export function useProvidersRepository() {
|
export function useProvidersRepository() {
|
||||||
return usePaginatedList<Provider>({ url: '/providers' })
|
// Pagination par defaut a 25 sur le repertoire (retour metier ERP-193).
|
||||||
|
return usePaginatedList<Provider>({ url: '/providers', defaultItemsPerPage: 25 })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ describe('useCarriersRepository', () => {
|
|||||||
expect(mockApiGet).toHaveBeenCalledTimes(1)
|
expect(mockApiGet).toHaveBeenCalledTimes(1)
|
||||||
const [url, query, opts] = mockApiGet.mock.calls[0]
|
const [url, query, opts] = mockApiGet.mock.calls[0]
|
||||||
expect(url).toBe('/carriers')
|
expect(url).toBe('/carriers')
|
||||||
expect(query).toMatchObject({ page: 1, itemsPerPage: 10 })
|
expect(query).toMatchObject({ page: 1, itemsPerPage: 25 })
|
||||||
expect(opts).toMatchObject({
|
expect(opts).toMatchObject({
|
||||||
toast: false,
|
toast: false,
|
||||||
headers: { Accept: 'application/ld+json' },
|
headers: { Accept: 'application/ld+json' },
|
||||||
|
|||||||
@@ -66,5 +66,6 @@ export interface CarrierFilters {
|
|||||||
* `usePaginatedList`. Aucun reset au logout a gerer.
|
* `usePaginatedList`. Aucun reset au logout a gerer.
|
||||||
*/
|
*/
|
||||||
export function useCarriersRepository() {
|
export function useCarriersRepository() {
|
||||||
return usePaginatedList<Carrier, CarrierFilters>({ url: '/carriers' })
|
// Pagination par defaut a 25 sur le repertoire (retour metier ERP-193).
|
||||||
|
return usePaginatedList<Carrier, CarrierFilters>({ url: '/carriers', defaultItemsPerPage: 25 })
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user