summaryrefslogtreecommitdiff
path: root/spec/frontend/ide/lib/editorconfig/parser_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/ide/lib/editorconfig/parser_spec.js')
-rw-r--r--spec/frontend/ide/lib/editorconfig/parser_spec.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/frontend/ide/lib/editorconfig/parser_spec.js b/spec/frontend/ide/lib/editorconfig/parser_spec.js
new file mode 100644
index 00000000000..f99410236e1
--- /dev/null
+++ b/spec/frontend/ide/lib/editorconfig/parser_spec.js
@@ -0,0 +1,18 @@
+import { getRulesWithTraversal } from '~/ide/lib/editorconfig/parser';
+import { exampleConfigs, exampleFiles } from './mock_data';
+
+describe('~/ide/lib/editorconfig/parser', () => {
+ const getExampleConfigContent = path =>
+ Promise.resolve(exampleConfigs.find(x => x.path === path)?.content);
+
+ 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 }) => {
+ return getRulesWithTraversal(path, getExampleConfigContent).then(result => {
+ expect(result).toEqual(rules);
+ });
+ },
+ );
+ });
+});