content-collection-references.test.js — astro Source File
Architecture documentation for content-collection-references.test.js, a javascript file in the astro codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 9eb7a997_e5e4_3cf2_484a_79c3227df436["content-collection-references.test.js"] 0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"] 9eb7a997_e5e4_3cf2_484a_79c3227df436 --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15 beb21e0a_5a04_1aeb_f065_5ab6c5ffe2ea["fixLineEndings"] 9eb7a997_e5e4_3cf2_484a_79c3227df436 --> beb21e0a_5a04_1aeb_f065_5ab6c5ffe2ea dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"] 9eb7a997_e5e4_3cf2_484a_79c3227df436 --> dd4f09ce_3fd7_8295_f616_8876cda4555c e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"] 9eb7a997_e5e4_3cf2_484a_79c3227df436 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607 6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"] 9eb7a997_e5e4_3cf2_484a_79c3227df436 --> 6b0635f9_51ea_77aa_767b_7857878e98a6 deb87372_5629_35f8_9a54_e755a08f776a["cheerio"] 9eb7a997_e5e4_3cf2_484a_79c3227df436 --> deb87372_5629_35f8_9a54_e755a08f776a style 9eb7a997_e5e4_3cf2_484a_79c3227df436 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 { fixLineEndings, loadFixture } from './test-utils.js';
describe('Content Collections - references', () => {
let fixture;
let devServer;
before(async () => {
fixture = await loadFixture({ root: './fixtures/content-collection-references/' });
});
const modes = ['dev', 'prod'];
for (const mode of modes) {
describe(mode, () => {
before(async () => {
if (mode === 'prod') {
await fixture.build({ force: true });
} else if (mode === 'dev') {
devServer = await fixture.startDevServer({ force: true });
await fixture.onNextDataStoreChange(1000).catch(() => {
// Ignore timeout, because it may have saved before we get here.
});
}
});
after(async () => {
if (mode === 'dev') devServer?.stop();
});
describe(`JSON result`, () => {
let json;
before(async () => {
if (mode === 'prod') {
const rawJson = await fixture.readFile('/welcome-data.json');
json = JSON.parse(rawJson);
} else if (mode === 'dev') {
const rawJsonResponse = await fixture.fetch('/welcome-data.json');
const rawJson = await rawJsonResponse.text();
json = JSON.parse(rawJson);
}
});
it('Returns expected keys', () => {
assert.ok(json.hasOwnProperty('welcomePost'));
assert.ok(json.hasOwnProperty('banner'));
assert.ok(json.hasOwnProperty('author'));
assert.ok(json.hasOwnProperty('relatedPosts'));
});
it('Returns `banner` data', () => {
const { banner } = json;
assert.ok(banner.hasOwnProperty('data'));
assert.equal(banner.id, 'welcome');
assert.equal(banner.collection, 'banners');
assert.equal(
banner.data.alt,
'Futuristic landscape with chrome buildings and blue skies',
);
// ... (102 more lines)
Domain
Dependencies
- cheerio
- fixLineEndings
- loadFixture
- node:test
- strict
- test-utils.js
Source
Frequently Asked Questions
What does content-collection-references.test.js do?
content-collection-references.test.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain.
What does content-collection-references.test.js depend on?
content-collection-references.test.js imports 6 module(s): cheerio, fixLineEndings, loadFixture, node:test, strict, test-utils.js.
Where is content-collection-references.test.js in the architecture?
content-collection-references.test.js is located at packages/astro/test/content-collection-references.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