dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
33 lines
947 B
JavaScript
33 lines
947 B
JavaScript
import isArray from 'lodash/isArray';
|
|
import { describe, beforeAll, it, expect } from 'vitest';
|
|
|
|
import parseFixture from '../../__fixtures__/parse-fixture';
|
|
import getAllBefore from './before-heading';
|
|
|
|
describe('before-headings', () => {
|
|
let simpleAst;
|
|
|
|
beforeAll(async () => {
|
|
simpleAst = await parseFixture('simple.md');
|
|
});
|
|
|
|
it('should return an array', () => {
|
|
expect.assertions(1);
|
|
const actual = getAllBefore(simpleAst, '--hints--');
|
|
expect(isArray(actual)).toBe(true);
|
|
});
|
|
|
|
it('should return an empty array if the marker is not present', () => {
|
|
expect.assertions(2);
|
|
const actual = getAllBefore(simpleAst, '--not-a-marker--');
|
|
expect(isArray(actual)).toBe(true);
|
|
expect(actual.length).toBe(0);
|
|
});
|
|
|
|
it('should include the whole AST before the marker', () => {
|
|
expect.assertions(1);
|
|
const actual = getAllBefore(simpleAst, '--hints--');
|
|
expect(actual).toHaveLength(6);
|
|
});
|
|
});
|