content-intellisense.test.js — astro Source File
Architecture documentation for content-intellisense.test.js, a javascript file in the astro codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR f1314d62_3fb3_78cc_3a43_b33f8deb7313["content-intellisense.test.js"] 0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"] f1314d62_3fb3_78cc_3a43_b33f8deb7313 --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15 dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"] f1314d62_3fb3_78cc_3a43_b33f8deb7313 --> dd4f09ce_3fd7_8295_f616_8876cda4555c e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"] f1314d62_3fb3_78cc_3a43_b33f8deb7313 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607 6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"] f1314d62_3fb3_78cc_3a43_b33f8deb7313 --> 6b0635f9_51ea_77aa_767b_7857878e98a6 style f1314d62_3fb3_78cc_3a43_b33f8deb7313 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('Content Intellisense', () => {
/** @type {import("./test-utils.js").Fixture} */
let fixture;
/** @type {string[]} */
let collectionsDir = [];
/** @type {{collections: {hasSchema: boolean, name: string}[], entries: Record<string, string>}} */
let manifest = undefined;
/** @type {Record<string, Array<{ id: string; data: any; filePath: string; collection: string }>>} */
let collections;
before(async () => {
fixture = await loadFixture({ root: './fixtures/content-intellisense/' });
await fixture.build();
collectionsDir = await fixture.readdir('../.astro/collections');
manifest = JSON.parse(await fixture.readFile('../.astro/collections/collections.json'));
collections = JSON.parse(await fixture.readFile('index.json'));
});
it('generate JSON schemas for content collections', async () => {
assert.equal(collectionsDir.includes('blog-cc.schema.json'), true);
});
it('generate JSON schemas for content layer', async () => {
assert.equal(collectionsDir.includes('blog-cl.schema.json'), true);
});
it('generate JSON schemas for file loader', async () => {
assert.equal(collectionsDir.includes('data-cl.schema.json'), true);
});
it('generate JSON schemas for data with unrepresentable types', async () => {
assert.equal(collectionsDir.includes('data-dates.schema.json'), true);
});
it('generates a record JSON schema for the file loader', async () => {
const schema = JSON.parse(await fixture.readFile('../.astro/collections/data-cl.schema.json'));
assert.equal(schema.type, 'object');
assert.equal(schema.additionalProperties.type, 'object');
assert.deepEqual(schema.additionalProperties.properties, {
name: { type: 'string' },
color: { type: 'string' },
});
});
it('manifest exists', async () => {
assert.notEqual(manifest, undefined);
});
it('manifest has content collections', async () => {
const manifestCollections = manifest.collections.map((collection) => collection.name);
assert.equal(
manifestCollections.includes('blog-cc'),
true,
"Expected 'blog-cc' collection in manifest",
);
});
it('manifest has content layer', async () => {
const manifestCollections = manifest.collections.map((collection) => collection.name);
assert.equal(
manifestCollections.includes('blog-cl'),
true,
"Expected 'blog-cl' collection in manifest",
);
});
it('has entries for content collections', async () => {
const collectionEntries = Object.entries(manifest.entries).filter((entry) =>
entry[0].includes('/packages/astro/test/fixtures/content-intellisense/src/content/blog-cc/'),
);
assert.equal(collectionEntries.length, 3, "Expected 3 entries for 'blog-cc' collection");
assert.equal(
collectionEntries.every((entry) => entry[1] === 'blog-cc'),
true,
"Expected 3 entries for 'blog-cc' collection to have 'blog-cc' as collection",
);
});
it('has entries for content layer', async () => {
const collectionEntries = Object.entries(manifest.entries).filter((entry) =>
entry[0].includes('/packages/astro/test/fixtures/content-intellisense/src/blog-cl/'),
);
assert.equal(collectionEntries.length, 3, "Expected 3 entries for 'blog-cl' collection");
assert.equal(
collectionEntries.every((entry) => entry[1] === 'blog-cl'),
true,
"Expected 3 entries for 'blog-cl' collection to have 'blog-cl' as collection name",
);
});
it('doesn’t generate a `$schema` entry for file loader if `$schema` value is a string', async () => {
assert.equal(collections['data-cl-json'].map((entry) => entry.id).includes('$schema'), false);
});
it('generates a `$schema` entry for file loader if `$schema` value isn’t a string', async () => {
assert.equal(
collections['data-schema-misuse'].map((entry) => entry.id).includes('$schema'),
true,
);
});
});
Domain
Dependencies
- loadFixture
- node:test
- strict
- test-utils.js
Source
Frequently Asked Questions
What does content-intellisense.test.js do?
content-intellisense.test.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain.
What does content-intellisense.test.js depend on?
content-intellisense.test.js imports 4 module(s): loadFixture, node:test, strict, test-utils.js.
Where is content-intellisense.test.js in the architecture?
content-intellisense.test.js is located at packages/astro/test/content-intellisense.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