Home / File/ non-html-pages.test.js — astro Source File

non-html-pages.test.js — astro Source File

Architecture documentation for non-html-pages.test.js, a javascript file in the astro codebase. 4 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  3c11b963_b9bb_6d10_da4c_ab7c38d05ce5["non-html-pages.test.js"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"]
  3c11b963_b9bb_6d10_da4c_ab7c38d05ce5 --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15
  dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"]
  3c11b963_b9bb_6d10_da4c_ab7c38d05ce5 --> dd4f09ce_3fd7_8295_f616_8876cda4555c
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  3c11b963_b9bb_6d10_da4c_ab7c38d05ce5 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  3c11b963_b9bb_6d10_da4c_ab7c38d05ce5 --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  style 3c11b963_b9bb_6d10_da4c_ab7c38d05ce5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

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

describe('Non-HTML Pages', () => {
	let fixture;

	before(async () => {
		fixture = await loadFixture({ root: './fixtures/non-html-pages/' });
		await fixture.build();
	});

	describe('json', () => {
		it('should match contents', async () => {
			const json = JSON.parse(await fixture.readFile('/about.json'));
			assert.equal(json.name, 'Astro');
			assert.equal(json.url, 'https://astro.build/');
		});
	});

	describe('png', () => {
		it('should not have had its encoding mangled', async () => {
			const buffer = await fixture.readFile('/placeholder.png', 'base64');

			// Sanity check the first byte
			const hex = Buffer.from(buffer, 'base64').toString('hex');
			const firstHexByte = hex.slice(0, 2);
			// If we accidentally utf8 encode the png, the first byte (in hex) will be 'c2'
			assert.notEqual(firstHexByte, 'c2');
			// and if correctly encoded in binary, it should be '89'
			assert.equal(firstHexByte, '89');

			// Make sure the whole buffer (in base64) matches this snapshot
			assert.equal(
				buffer,
				'iVBORw0KGgoAAAANSUhEUgAAAGQAAACWCAMAAAAfZt10AAAABlBMVEXd3d3+/v7B/CFgAAAA3UlEQVR42u3ZMQ7DIBQFQeb+l06bNgUbG/5eYApLFjzWNE3TNE3TNE035av9AhAQEBBQGAQEFAaFQWFQGBQGhUGCKAwKgwQpDJ6JECgCRYIEikH8YAyCRyEGyRCDvBWRIPNNBpm/8G6kUM45EhXKlQfuFSHFpbFH+jt2j/S7xwqUYvBaCRIozZy6X2km7v1K8uwQIIWBwkBAQEBg3Tyj3z4LnzRBKgwKg8KgMEgQhaEwSBCFQWBEiMIgQQqDBCkMEqQw+APixYgcsa0TERs7D/F6xGmIAxCD/Iw4AvEB92Ec3ZAPdlMAAAAASUVORK5CYII=',
			);
		});
	});
});

Dependencies

Frequently Asked Questions

What does non-html-pages.test.js do?
non-html-pages.test.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain.
What does non-html-pages.test.js depend on?
non-html-pages.test.js imports 4 module(s): loadFixture, node:test, strict, test-utils.js.
Where is non-html-pages.test.js in the architecture?
non-html-pages.test.js is located at packages/astro/test/non-html-pages.test.js (domain: IntegrationAdapters, directory: packages/astro/test).

Analyze Your Own Codebase

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

Try Supermodel Free