content-layer.test.js — astro Source File
Architecture documentation for content-layer.test.js, a javascript file in the astro codebase. 12 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 09afe1cb_6bd5_4047_fdda_a032bad40043["content-layer.test.js"] f5b154b4_7bf2_7c8f_2105_5c84d2420bd1["../../dist/core/logger/core.js"] 09afe1cb_6bd5_4047_fdda_a032bad40043 --> f5b154b4_7bf2_7c8f_2105_5c84d2420bd1 0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"] 09afe1cb_6bd5_4047_fdda_a032bad40043 --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15 dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"] 09afe1cb_6bd5_4047_fdda_a032bad40043 --> dd4f09ce_3fd7_8295_f616_8876cda4555c e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"] 09afe1cb_6bd5_4047_fdda_a032bad40043 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607 e16a223b_37f3_6b25_1ee1_2b7bcb9d9415["node:fs"] 09afe1cb_6bd5_4047_fdda_a032bad40043 --> e16a223b_37f3_6b25_1ee1_2b7bcb9d9415 c52a5f83_66e3_37d7_9ebb_767f7129bc62["node:path"] 09afe1cb_6bd5_4047_fdda_a032bad40043 --> c52a5f83_66e3_37d7_9ebb_767f7129bc62 93ddfcfe_d0f6_a3f6_9170_67e40e4f7a6a["posix"] 09afe1cb_6bd5_4047_fdda_a032bad40043 --> 93ddfcfe_d0f6_a3f6_9170_67e40e4f7a6a 8f34f3e8_2f0f_1f0d_91dc_c25ece8c8169["node:stream"] 09afe1cb_6bd5_4047_fdda_a032bad40043 --> 8f34f3e8_2f0f_1f0d_91dc_c25ece8c8169 6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"] 09afe1cb_6bd5_4047_fdda_a032bad40043 --> 6b0635f9_51ea_77aa_767b_7857878e98a6 436bd5b5_624c_3fc2_183f_0bcb296cdd8e["promises"] 09afe1cb_6bd5_4047_fdda_a032bad40043 --> 436bd5b5_624c_3fc2_183f_0bcb296cdd8e deb87372_5629_35f8_9a54_e755a08f776a["cheerio"] 09afe1cb_6bd5_4047_fdda_a032bad40043 --> deb87372_5629_35f8_9a54_e755a08f776a ca52ff61_c81f_c2ca_81b6_5a678b65fd31["devalue"] 09afe1cb_6bd5_4047_fdda_a032bad40043 --> ca52ff61_c81f_c2ca_81b6_5a678b65fd31 style 09afe1cb_6bd5_4047_fdda_a032bad40043 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import assert from 'node:assert/strict';
import { existsSync, promises as fs } from 'node:fs';
import { sep } from 'node:path';
import { sep as posixSep } from 'node:path/posix';
import { Writable } from 'node:stream';
import { after, before, describe, it } from 'node:test';
import { setTimeout } from 'node:timers/promises';
import * as cheerio from 'cheerio';
import * as devalue from 'devalue';
import { Logger } from '../dist/core/logger/core.js';
import { loadFixture } from './test-utils.js';
describe('Content Layer', () => {
/** @type {import("./test-utils.js").Fixture} */
let fixture;
before(async () => {
fixture = await loadFixture({ root: './fixtures/content-layer/' });
});
describe('Build', () => {
let json;
let $;
before(async () => {
fixture = await loadFixture({ root: './fixtures/content-layer/' });
await fs
.unlink(new URL('./node_modules/.astro/data-store.json', fixture.config.root))
.catch(() => {});
await fixture.build({ force: true });
const rawJson = await fixture.readFile('/collections.json');
const html = await fixture.readFile('/spacecraft/lunar-module/index.html');
$ = cheerio.load(html);
json = devalue.parse(rawJson);
});
it('Returns custom loader collection', async () => {
assert.ok(json.hasOwnProperty('customLoader'));
assert.ok(Array.isArray(json.customLoader));
const item = json.customLoader[0];
assert.deepEqual(item, {
id: '1',
collection: 'blog',
data: {
userId: 1,
id: 1,
title: 'sunt aut facere repellat provident occaecati excepturi optio reprehenderit',
body: 'quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto',
},
});
});
it('filters collection items', async () => {
assert.ok(json.hasOwnProperty('customLoader'));
assert.ok(Array.isArray(json.customLoader));
assert.equal(json.customLoader.length, 5);
});
it('Returns json `file()` loader collection', async () => {
// ... (735 more lines)
Domain
Dependencies
- ../../dist/core/logger/core.js
- cheerio
- devalue
- loadFixture
- node:fs
- node:path
- node:stream
- node:test
- posix
- promises
- strict
- test-utils.js
Source
Frequently Asked Questions
What does content-layer.test.js do?
content-layer.test.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain.
What does content-layer.test.js depend on?
content-layer.test.js imports 12 module(s): ../../dist/core/logger/core.js, cheerio, devalue, loadFixture, node:fs, node:path, node:stream, node:test, and 4 more.
Where is content-layer.test.js in the architecture?
content-layer.test.js is located at packages/astro/test/content-layer.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