Skip to content

Commit

Permalink
update:Add->Test
Browse files Browse the repository at this point in the history
  • Loading branch information
NguyenBaoCoder committed May 18, 2024
1 parent 817c0b1 commit 6de917e
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions __tests__/api/prompt/route.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,5 @@ describe('API Prompt', () => {
})
});

import { GET } from "@/app/api/prompt/route";
import axios from "axios";

describe("API Prompt Route", () => {
it("should make a JSON data GET request to http://localhost:3000/api/prompt", async () => {
const mockResponse = { /* Mock response data */ };
global.fetch = jest.fn().mockResolvedValue({
ok: true,
json: jest.fn().mockResolvedValue(mockResponse)
});c

await fetchData();

expect(fetch).toHaveBeenCalledWith('http://localhost:3000/api/prompt');
expect(fetch).toHaveBeenCalledTimes(1);
expect(console.log).toHaveBeenCalledWith(mockResponse);
})
})

0 comments on commit 6de917e

Please sign in to comment.