debian-mirror-gitlab/spec/frontend/ide/lib/editorconfig/parser_spec.js

19 lines
705 B
JavaScript
Raw Normal View History

2020-06-23 00:09:42 +05:30
import { getRulesWithTraversal } from '~/ide/lib/editorconfig/parser';
import { exampleConfigs, exampleFiles } from './mock_data';
describe('~/ide/lib/editorconfig/parser', () => {
2021-03-08 18:12:59 +05:30
const getExampleConfigContent = (path) =>
Promise.resolve(exampleConfigs.find((x) => x.path === path)?.content);
2020-06-23 00:09:42 +05:30
describe('getRulesWithTraversal', () => {
it.each(exampleFiles)(
'traverses through all editorconfig files in parent directories (until root=true is hit) and finds rules for this file (case %#)',
({ path, rules }) => {
2021-03-08 18:12:59 +05:30
return getRulesWithTraversal(path, getExampleConfigContent).then((result) => {
2020-06-23 00:09:42 +05:30
expect(result).toEqual(rules);
});
},
);
});
});