content-collections.test.js — astro Source File
Architecture documentation for content-collections.test.js, a javascript file in the astro codebase. 9 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR ee2aecef_0e02_3d96_17fd_685edf4aee44["content-collections.test.js"] be670a78_841c_46e5_0af5_c5c328869ecb["test-adapter.js"] ee2aecef_0e02_3d96_17fd_685edf4aee44 --> be670a78_841c_46e5_0af5_c5c328869ecb 3d360664_2e29_48cd_8f31_7a5358be685d["test-plugins.js"] ee2aecef_0e02_3d96_17fd_685edf4aee44 --> 3d360664_2e29_48cd_8f31_7a5358be685d b3e723b6_89ee_5b2f_45ce_2c99606d46d1["preventNodeBuiltinDependencyPlugin"] ee2aecef_0e02_3d96_17fd_685edf4aee44 --> b3e723b6_89ee_5b2f_45ce_2c99606d46d1 0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"] ee2aecef_0e02_3d96_17fd_685edf4aee44 --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15 dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"] ee2aecef_0e02_3d96_17fd_685edf4aee44 --> dd4f09ce_3fd7_8295_f616_8876cda4555c e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"] ee2aecef_0e02_3d96_17fd_685edf4aee44 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607 6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"] ee2aecef_0e02_3d96_17fd_685edf4aee44 --> 6b0635f9_51ea_77aa_767b_7857878e98a6 deb87372_5629_35f8_9a54_e755a08f776a["cheerio"] ee2aecef_0e02_3d96_17fd_685edf4aee44 --> deb87372_5629_35f8_9a54_e755a08f776a ca52ff61_c81f_c2ca_81b6_5a678b65fd31["devalue"] ee2aecef_0e02_3d96_17fd_685edf4aee44 --> ca52ff61_c81f_c2ca_81b6_5a678b65fd31 style ee2aecef_0e02_3d96_17fd_685edf4aee44 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import assert from 'node:assert/strict';
import { before, describe, it } from 'node:test';
import * as cheerio from 'cheerio';
import * as devalue from 'devalue';
import testAdapter from './test-adapter.js';
import { preventNodeBuiltinDependencyPlugin } from './test-plugins.js';
import { loadFixture } from './test-utils.js';
describe('Content Collections', () => {
describe('Query', () => {
let fixture;
before(async () => {
fixture = await loadFixture({ root: './fixtures/content-collections/' });
await fixture.build({ force: true });
});
describe('Collection', () => {
let json;
before(async () => {
const rawJson = await fixture.readFile('/collections.json');
json = devalue.parse(rawJson);
});
it('Returns `with schema` collection', async () => {
assert.ok(json.hasOwnProperty('withSchemaConfig'));
assert.equal(Array.isArray(json.withSchemaConfig), true);
const ids = json.withSchemaConfig.map((item) => item.id);
const publishedDates = json.withSchemaConfig.map((item) => item.data.publishedAt);
assert.deepEqual(ids.sort(), ['four%', 'one', 'three', 'two'].sort());
assert.equal(
publishedDates.every((date) => date instanceof Date),
true,
'Not all publishedAt dates are Date objects',
);
assert.deepEqual(
publishedDates.map((date) => date.toISOString()).sort(),
[
'2021-01-01T00:00:00.000Z',
'2021-01-01T00:00:00.000Z',
'2021-01-03T00:00:00.000Z',
'2021-01-02T00:00:00.000Z',
].sort(),
);
});
it('Returns `with custom slugs` collection', async () => {
assert.ok(json.hasOwnProperty('withCustomSlugs'));
assert.equal(Array.isArray(json.withCustomSlugs), true);
const slugs = json.withCustomSlugs.map((item) => item.id);
assert.deepEqual(slugs.sort(), ['fancy-one', 'excellent-three', 'interesting-two'].sort());
});
it('Returns `with union schema` collection', async () => {
assert.ok(json.hasOwnProperty('withUnionSchema'));
assert.equal(Array.isArray(json.withUnionSchema), true);
const post = json.withUnionSchema.find((item) => item.id === 'post');
assert.notEqual(post, undefined);
// ... (330 more lines)
Domain
Dependencies
- cheerio
- devalue
- loadFixture
- node:test
- preventNodeBuiltinDependencyPlugin
- strict
- test-adapter.js
- test-plugins.js
- test-utils.js
Source
Frequently Asked Questions
What does content-collections.test.js do?
content-collections.test.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain.
What does content-collections.test.js depend on?
content-collections.test.js imports 9 module(s): cheerio, devalue, loadFixture, node:test, preventNodeBuiltinDependencyPlugin, strict, test-adapter.js, test-plugins.js, and 1 more.
Where is content-collections.test.js in the architecture?
content-collections.test.js is located at packages/astro/test/content-collections.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