/
vasya2
/
var
Обзор
Документация
Войти
/
vasya2
/
var
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
tools/challenge-parser/parser/plugins/utils/before-heading.test.js
31 строка
904 B
Oliver Eyton-Williams
refactor: clean up parser test code (#56271)
25 сен 2024, 10:34
Не верифицирован
25 сен 2024, 10:34
435cbc0
Код
Авторство
О чём код?
const isArray = require('lodash/isArray'); const parseFixture = require('../../__fixtures__/parse-fixture'); const getAllBefore = require('./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); }); });