data-collections.test.js — astro Source File
Architecture documentation for data-collections.test.js, a javascript file in the astro codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR a69f125c_c17a_56d8_97bf_e4e5d064159b["data-collections.test.js"] 0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"] a69f125c_c17a_56d8_97bf_e4e5d064159b --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15 dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"] a69f125c_c17a_56d8_97bf_e4e5d064159b --> dd4f09ce_3fd7_8295_f616_8876cda4555c e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"] a69f125c_c17a_56d8_97bf_e4e5d064159b --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607 6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"] a69f125c_c17a_56d8_97bf_e4e5d064159b --> 6b0635f9_51ea_77aa_767b_7857878e98a6 style a69f125c_c17a_56d8_97bf_e4e5d064159b 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';
const authorIds = ['Ben Holmes', 'Fred K Schott', 'Nate Moore'];
const translationIds = ['en', 'es', 'fr'];
describe('Content Collections - data collections', () => {
let fixture;
before(async () => {
fixture = await loadFixture({ root: './fixtures/data-collections/' });
await fixture.build({ force: true });
});
describe('Authors Collection', () => {
let json;
before(async () => {
const rawJson = await fixture.readFile('/authors/all.json');
json = JSON.parse(rawJson);
});
it('Returns', async () => {
assert.equal(Array.isArray(json), true);
assert.equal(json.length, 3);
});
it('Generates correct ids', async () => {
const ids = json.map((item) => item.id).sort();
assert.deepEqual(ids.sort(), ['Ben Holmes', 'Fred K Schott', 'Nate Moore'].sort());
});
it('Generates correct data', async () => {
const names = json.map((item) => item.data.name);
assert.deepEqual(
names.sort(),
['Ben J Holmes', 'Fred K Schott', 'Nate Something Moore'].sort(),
);
const twitterUrls = json.map((item) => item.data.twitter);
assert.deepEqual(
twitterUrls.sort(),
[
'https://twitter.com/bholmesdev',
'https://twitter.com/FredKSchott',
'https://twitter.com/n_moore',
].sort(),
);
});
});
describe('getDataEntryById', () => {
let json;
before(async () => {
const rawJson = await fixture.readFile('/translations/by-id.json');
json = JSON.parse(rawJson);
});
it('Grabs the item by the base file name', () => {
assert.equal(json.id, 'en');
});
});
// ... (106 more lines)
Domain
Dependencies
- loadFixture
- node:test
- strict
- test-utils.js
Source
Frequently Asked Questions
What does data-collections.test.js do?
data-collections.test.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain.
What does data-collections.test.js depend on?
data-collections.test.js imports 4 module(s): loadFixture, node:test, strict, test-utils.js.
Where is data-collections.test.js in the architecture?
data-collections.test.js is located at packages/astro/test/data-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