diff --git a/src/app/infrastructure/profiles/pb-profile.repository.ts b/src/app/infrastructure/profiles/pb-profile.repository.ts index d74caf2..7ff7037 100644 --- a/src/app/infrastructure/profiles/pb-profile.repository.ts +++ b/src/app/infrastructure/profiles/pb-profile.repository.ts @@ -11,13 +11,13 @@ export class PbProfileRepository implements ProfileRepository { private pb = new PocketBase(environment.baseUrl); list(): Observable { - return from( - this.pb.collection('profiles').getFullList({ - sort: 'profession', - expand: 'utilisateur', - filter: 'utilisateur.verified=true', - }) - ); + const options = { + sort: 'profession', + expand: 'utilisateur', + filter: + "utilisateur.verified=true && utilisateur.name !='' && profession!='Profession non renseignée' && secteur!='' ", + }; + return from(this.pb.collection('profiles').getFullList(options)); } getByUserId(userId: string): Observable { diff --git a/src/app/testing/infrastructure/profiles/pb-profile.repository.spec.ts b/src/app/testing/infrastructure/profiles/pb-profile.repository.spec.ts index c9505c9..7098653 100644 --- a/src/app/testing/infrastructure/profiles/pb-profile.repository.spec.ts +++ b/src/app/testing/infrastructure/profiles/pb-profile.repository.spec.ts @@ -38,14 +38,15 @@ describe('PbProfileRepository', () => { // ------------------------------------------ it('devrait appeler pb.collection("profiles").getFullList() avec un tri par profession', (done) => { mockCollection.getFullList.mockResolvedValue(mockProfiles); - + const options = { + sort: 'profession', + expand: 'utilisateur', + filter: + "utilisateur.verified=true && utilisateur.name !='' && profession!='Profession non renseignée' && secteur!='' ", + }; repo.list().subscribe((result) => { expect(mockPocketBase.collection).toHaveBeenCalledWith('profiles'); - expect(mockCollection.getFullList).toHaveBeenCalledWith({ - sort: 'profession', - expand: 'utilisateur', - filter: 'utilisateur.verified=true', - }); + expect(mockCollection.getFullList).toHaveBeenCalledWith(options); expect(result).toEqual(mockProfiles); done(); });