summaryrefslogtreecommitdiff
path: root/packages/integrations/cloudflare/test/external-image-service.test.js
blob: 28ef544ca54d38229c33df60c6335f82364f1ca5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import * as assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { describe, it } from 'node:test';
import { fileURLToPath } from 'node:url';
import { glob } from 'tinyglobby';
import { astroCli } from './_test-utils.js';

const root = new URL('./fixtures/external-image-service/', import.meta.url);

describe('ExternalImageService', () => {
	it('has correct image service', async () => {
		await astroCli(fileURLToPath(root), 'build');
		const files = await glob('**/image-service_*.mjs', {
			cwd: fileURLToPath(new URL('dist/_worker.js', root)),
			filesOnly: true,
			absolute: true,
			flush: true,
		});
		const outFileToCheck = readFileSync(files[0], 'utf-8');
		assert.equal(outFileToCheck.includes('cdn-cgi/image'), true);
	});
});