Skip to content

Commit

Permalink
fix[tests]: arruma testes de pattern service
Browse files Browse the repository at this point in the history
  • Loading branch information
GRVial committed Sep 6, 2024
1 parent d6d11a0 commit b639c57
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/tests/services/patternService.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,26 @@ describe('pattern endpoints', () => {

it('gets a pattern by id successfully', async () => {
const id = 1;
api.get.mockResolvedValue({ status: 200, data: "some data" })

const mockData = "some data";
api.get.mockResolvedValue({ status: 200, data: mockData });

const result = await getPadrao(id);

expect(api.get).toHaveBeenCalledWith(`/printer/padrao/${id}`);
expect(result).toEqual({ type: 'success' });
expect(result).toEqual({ type: 'success', data: mockData });
});

it('gets a pattern by id and returns error status code', async () => {
const id = 2;
api.get.mockResolvedValue({ status: 404, data: "some data" })

const mockData = "some data";
api.get.mockResolvedValue({ status: 404, data: mockData });

const result = await getPadrao(id);

expect(api.get).toHaveBeenCalledWith(`/printer/padrao/${id}`);
expect(result).toEqual({ type: 'error' });
expect(result).toEqual({ type: 'error', data: mockData });
});


it('gets a pattern by id and throws error', async () => {
const id = 3;
Expand Down

0 comments on commit b639c57

Please sign in to comment.