Skip to content

Commit

Permalink
(#184) cria teste para busca sem acento
Browse files Browse the repository at this point in the history
  • Loading branch information
martinsglucas committed Nov 18, 2023
1 parent 49ab00c commit dc38d9f
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/publicacao/publicacao.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe('PublicacaoService', () => {
describe('findAll', () => {
const publicacao = {
id: 1,
titulo: 'titulo',
titulo: 'título',
descricao: 'descricao',
};

Expand Down Expand Up @@ -158,5 +158,30 @@ describe('PublicacaoService', () => {
expect(count).toEqual(1);
expect(data[0]).toEqual(publicacao);
});

it('should findAll Publicacao with title unaccent', async () => {
jest.spyOn(clientProxy, 'send').mockReturnValue(of([{ id: 1 }]) as any);
jest.spyOn(repository, 'createQueryBuilder').mockReturnValue({
where: () => ({
limit: () => ({
offset: () => ({
orderBy: () => ({
getManyAndCount: jest
.fn()
.mockResolvedValueOnce([[publicacao], 1]),
}),
}),
}),
}),
} as any);

const { data, count } = await service.findAll(
{ titulo: "titulo" },
ordering,
pagination,
);
expect(count).toEqual(1);
expect(data[0]).toEqual(publicacao);
});
});
});

0 comments on commit dc38d9f

Please sign in to comment.