get-entry-info.test.js — astro Source File
Architecture documentation for get-entry-info.test.js, a javascript file in the astro codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 0e831988_9af0_13dd_4804_620fb1b307a9["get-entry-info.test.js"] 4fc0ebf6_9d32_74a0_fbd7_52731484bef6["../../../dist/content/utils.js"] 0e831988_9af0_13dd_4804_620fb1b307a9 --> 4fc0ebf6_9d32_74a0_fbd7_52731484bef6 e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"] 0e831988_9af0_13dd_4804_620fb1b307a9 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607 6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"] 0e831988_9af0_13dd_4804_620fb1b307a9 --> 6b0635f9_51ea_77aa_767b_7857878e98a6 style 0e831988_9af0_13dd_4804_620fb1b307a9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import * as assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import { getContentEntryIdAndSlug, getEntryCollectionName } from '../../../dist/content/utils.js';
describe('Content Collections - entry info', () => {
const contentDir = new URL('src/content/', import.meta.url);
it('Returns correct collection name', () => {
const entry = new URL('blog/first-post.md', contentDir);
const collection = getEntryCollectionName({ entry, contentDir });
assert.equal(collection, 'blog');
});
it('Detects when entry is outside of a collection', () => {
const entry = new URL('base-post.md', contentDir);
const collection = getEntryCollectionName({ entry, contentDir });
assert.equal(collection, undefined);
});
it('Returns correct collection when nested directories used', () => {
const entry = new URL('docs/2021/01/01/index.md', contentDir);
const collection = getEntryCollectionName({ entry, contentDir });
assert.equal(collection, 'docs');
});
it('Returns correct entry info', () => {
const collection = 'blog';
const entry = new URL(`${collection}/first-post.md`, contentDir);
const info = getContentEntryIdAndSlug({ entry, contentDir, collection });
assert.equal(info.id, 'first-post.md');
assert.equal(info.slug, 'first-post');
});
it('Returns correct slug when spaces used', () => {
const collection = 'blog';
const entry = new URL(`${collection}/first post.mdx`, contentDir);
const info = getContentEntryIdAndSlug({ entry, contentDir, collection });
assert.equal(info.slug, 'first-post');
});
it('Returns correct slug when nested directories used', () => {
const collection = 'blog';
const entry = new URL(`${collection}/2021/01/01/index.md`, contentDir);
const info = getContentEntryIdAndSlug({ entry, contentDir, collection });
assert.equal(info.slug, '2021/01/01');
});
});
Domain
Dependencies
- ../../../dist/content/utils.js
- node:test
- strict
Source
Frequently Asked Questions
What does get-entry-info.test.js do?
get-entry-info.test.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain.
What does get-entry-info.test.js depend on?
get-entry-info.test.js imports 3 module(s): ../../../dist/content/utils.js, node:test, strict.
Where is get-entry-info.test.js in the architecture?
get-entry-info.test.js is located at packages/astro/test/units/content-collections/get-entry-info.test.js (domain: IntegrationAdapters, directory: packages/astro/test/units/content-collections).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free