Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
neekolas committed Mar 25, 2024
1 parent ceb8e0f commit df85541
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/server/src/handlers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,12 @@ describe('media', () => {
// Use the content type from the media server, not just the file name
expect(response.headers.get('content-type')).toEqual('image/png');
});

test('should pass through status when non-200', async () => {
const mediaUrl = `http://localhost:${MEDIA_PORT}/doesnotexist.png`;
const mediaRequest = new Request(`http://localhost/media?url=${encodeURIComponent(mediaUrl)}`);
const response = await handleMedia(mediaRequest);
// Use the content type from the media server, not just the file name
expect(response.status).toEqual(404);
});
});

0 comments on commit df85541

Please sign in to comment.