Skip to content

Commit

Permalink
All test pass somehow, it may be related to extraneous asynchronous a…
Browse files Browse the repository at this point in the history
…ctivity.
  • Loading branch information
abidjappie committed Feb 14, 2024
1 parent 2d97ce8 commit afa37ea
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions packages/netlify/test/functions/image-cdn.test.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,28 @@
import { loadFixture } from '@astrojs/test-utils';
import { describe, it, afterEach, beforeEach } from 'node:test';
import { describe, it, after } from 'node:test';
import * as assert from 'node:assert/strict';

describe('Image CDN', () => {
const root = new URL('./fixtures/middleware/', import.meta.url);

describe('when running outside of netlify', () => {
afterEach(() => {
process.env.NETLIFY = undefined;
process.env.DISABLE_IMAGE_CDN = undefined;
});

it('does not enable Image CDN', async () => {
const fixture = await loadFixture({ root });
await fixture.build();

const astronautPage = await fixture.readFile('astronaut/index.html');
assert.equal(astronautPage.includes(`src="/_astro/astronaut.`),true);
});

});

describe('when running inside of netlify', () => {
afterEach(() => {
after(() => {
process.env.NETLIFY = undefined;
process.env.DISABLE_IMAGE_CDN = undefined;
});

it('enables Netlify Image CDN', async () => {
it('enables Netlify Image CDN',async () => {
process.env.NETLIFY = 'true';
const fixture = await loadFixture({ root });
await fixture.build();
Expand Down

0 comments on commit afa37ea

Please sign in to comment.