Skip to content

Commit

Permalink
test: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rabelloo committed Jan 25, 2024
1 parent 1e9dd9f commit 5d4e62a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions examples/features/cobadged/src/utils/get.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ describe('get', () => {

beforeEach(() => {
vi.clearAllMocks();

const json = {};
const response = { json: () => json };
fetch.mockResolvedValueOnce(response as any);
const response = { json: () => ({}) };
fetch.mockResolvedValue(response as any);
});

it('should fetch', async () => {
Expand Down
4 changes: 2 additions & 2 deletions examples/features/cobadged/src/utils/post.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { post } from './post';
describe('post', () => {
beforeEach(() => {
vi.clearAllMocks();
const response = { json: () => {} };
const response = { json: () => ({}) };
vi.spyOn(globalThis, 'fetch').mockResolvedValue(response as any);
});

Expand All @@ -28,7 +28,7 @@ describe('post', () => {
});
});

it.only('should handle errors', async () => {
it('should handle errors', async () => {
const error = { description: 'description' };
vi.mocked(fetch).mockResolvedValueOnce({ json: () => ({ error }) } as any);

Expand Down

0 comments on commit 5d4e62a

Please sign in to comment.