image.test.js 952 B

123456789101112131415161718192021222324252627282930313233343536
  1. import * as assert from 'node:assert/strict';
  2. import { describe, it, before, after } from 'node:test';
  3. import nodejs from '../dist/index.js';
  4. import { loadFixture } from './test-utils.js';
  5. // Temporary skip until we figure out the "Could not find Sharp" issue as `sharp` is bundled
  6. describe.skip('Image endpoint', () => {
  7. /** @type {import('./test-utils').Fixture} */
  8. let fixture;
  9. let devPreview;
  10. before(async () => {
  11. fixture = await loadFixture({
  12. root: './fixtures/image/',
  13. output: 'server',
  14. adapter: nodejs({ mode: 'standalone' }),
  15. });
  16. await fixture.build();
  17. devPreview = await fixture.preview();
  18. });
  19. after(async () => {
  20. await devPreview.stop();
  21. });
  22. it('it returns images', async () => {
  23. const res = await fixture.fetch('/');
  24. assert.equal(res.status, 200);
  25. const resImage = await fixture.fetch(
  26. '/_image?href=/_astro/some_penguin.97ef5f92.png&w=50&f=webp'
  27. );
  28. assert.equal(resImage.status, 200);
  29. });
  30. });