Home / File/ astro-dev-platform.test.js — astro Source File

astro-dev-platform.test.js — astro Source File

Architecture documentation for astro-dev-platform.test.js, a javascript file in the astro codebase. 5 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  6d864234_73bd_7615_4440_c38e85aa668f["astro-dev-platform.test.js"]
  635e1221_67bb_e784_624a_d6d63643872b["_test-utils.js"]
  6d864234_73bd_7615_4440_c38e85aa668f --> 635e1221_67bb_e784_624a_d6d63643872b
  33b9a01d_12ac_568f_9775_9e80b35139cb["loadFixture"]
  6d864234_73bd_7615_4440_c38e85aa668f --> 33b9a01d_12ac_568f_9775_9e80b35139cb
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  6d864234_73bd_7615_4440_c38e85aa668f --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  6d864234_73bd_7615_4440_c38e85aa668f --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  deb87372_5629_35f8_9a54_e755a08f776a["cheerio"]
  6d864234_73bd_7615_4440_c38e85aa668f --> deb87372_5629_35f8_9a54_e755a08f776a
  style 6d864234_73bd_7615_4440_c38e85aa668f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import * as assert from 'node:assert/strict';
import { after, before, describe, it } from 'node:test';
import * as cheerio from 'cheerio';
import { loadFixture } from './_test-utils.js';

describe('AstroDevPlatform', () => {
	let fixture;
	let devServer;
	before(async () => {
		fixture = await loadFixture({
			root: './fixtures/astro-dev-platform/',
		});
		devServer = await fixture.startDevServer();
		// Do an initial request to prime preloading
		await fixture.fetch('/');
	});

	after(async () => {
		await devServer.stop();
	});

	it('adds cf object', async () => {
		const res = await fixture.fetch('/');
		const html = await res.text();
		const $ = cheerio.load(html);
		assert.equal($('#hasCF').text(), 'true');
	});

	it('adds cache mocking', async () => {
		const res = await fixture.fetch('/caches');
		const html = await res.text();
		const $ = cheerio.load(html);
		assert.equal($('#hasCACHE').text(), 'true');
	});

	it('adds D1 mocking', async () => {
		const res = await fixture.fetch('/d1');
		const html = await res.text();
		const $ = cheerio.load(html);
		assert.equal($('#hasDB').text(), 'true');
		assert.equal($('#hasPRODDB').text(), 'true');
		assert.equal($('#hasACCESS').text(), 'true');
	});

	it('adds R2 mocking', async () => {
		const res = await fixture.fetch('/r2');
		const html = await res.text();
		const $ = cheerio.load(html);
		assert.equal($('#hasBUCKET').text(), 'true');
		assert.equal($('#hasPRODBUCKET').text(), 'true');
		assert.equal($('#hasACCESS').text(), 'true');
	});

	it('adds KV mocking', async () => {
		const res = await fixture.fetch('/kv');
		const html = await res.text();
		const $ = cheerio.load(html);
		assert.equal($('#hasKV').text(), 'true');
		assert.equal($('#hasPRODKV').text(), 'true');
		assert.equal($('#hasACCESS').text(), 'true');
	});
});

Domain

Dependencies

Frequently Asked Questions

What does astro-dev-platform.test.js do?
astro-dev-platform.test.js is a source file in the astro codebase, written in javascript. It belongs to the CoreAstro domain.
What does astro-dev-platform.test.js depend on?
astro-dev-platform.test.js imports 5 module(s): _test-utils.js, cheerio, loadFixture, node:test, strict.
Where is astro-dev-platform.test.js in the architecture?
astro-dev-platform.test.js is located at packages/integrations/cloudflare/test/astro-dev-platform.test.js (domain: CoreAstro, directory: packages/integrations/cloudflare/test).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free