You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it("should write a 🔥 emoji besides the title if the story has a score higher than 100", async () => {
// Build
const mockStoryIds = [1, 2];
const mockStoryDetails = [
{ title: "Story 1", url: "http://example.com/story1", score: 100 },
{ title: "Story 2", url: "http://example.com/story2", score: 200 },
];
// Mock the get function of axios to return the mockStoryIds response
axiosSpy.mockResolvedValueOnce({ data: mockStoryIds });
// Mock the get function of axios to return the mockStoryDetails responses
mockStoryIds.forEach((id, index) => {
axiosSpy.mockResolvedValueOnce({ data: mockStoryDetails[index] });
});
render(<App />);
// Operate
const storyTitle = await screen.findByText(/Story 2/i);
// Check
expect(storyTitle.textContent).toContain("🔥");
});
it("should not write a 🔥 emoji besides the title if the story has a score lower than 100", async () => {
// Build
const mockStoryIds = [1, 2];
const mockStoryDetails = [
{ title: "Story 1", url: "http://example.com/story1", score: 100 },
{ title: "Story 2", url: "http://example.com/story2", score: 200 },
];
// Mock the get function of axios to return the mockStoryIds response
axiosSpy.mockResolvedValueOnce({ data: mockStoryIds });
// Mock the get function of axios to return the mockStoryDetails responses
mockStoryIds.forEach((id, index) => {
axiosSpy.mockResolvedValueOnce({ data: mockStoryDetails[index] });
});
render(<App />);
// Operate
const storyTitle = await screen.findByText(/Story 1/i);
// Check
expect(storyTitle.textContent).not.toContain("🔥");
});
});
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: