Skip to content

Commit 34ed20c

Browse files
committed
test: - Add multi-line examples to the 'explain everything' tests
1 parent 615fe16 commit 34ed20c

File tree

1 file changed

+46
-4
lines changed

1 file changed

+46
-4
lines changed

tests/Query/Explain/Explainer.test.ts

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,18 @@ describe('explain errors', () => {
4646

4747
describe('explain everything', () => {
4848
const sampleOfAllInstructionTypes = `
49+
filter by function \\
50+
task.path === '{{query.file.path}}'
4951
not done
5052
(has start date) AND (description includes some)
5153
54+
group by function \\
55+
task.path.includes('{{query.file.path}}')
5256
group by priority reverse
5357
group by happens
5458
59+
sort by function \\
60+
task.path.includes('{{query.file.path}}')
5561
sort by description reverse
5662
sort by path
5763
@@ -65,19 +71,37 @@ limit groups 3
6571
// Disable sort instructions
6672
updateSettings({ debugSettings: new DebugSettings(true) });
6773

68-
const query = new Query(sampleOfAllInstructionTypes);
74+
const query = new Query(sampleOfAllInstructionTypes, new TasksFile('sample.md'));
6975
expect(explainer.explainQuery(query)).toMatchInlineSnapshot(`
70-
"not done
76+
"filter by function \\
77+
task.path === '{{query.file.path}}'
78+
=>
79+
filter by function task.path === '{{query.file.path}}' =>
80+
filter by function task.path === 'sample.md'
81+
82+
not done
7183
7284
(has start date) AND (description includes some) =>
7385
AND (All of):
7486
has start date
7587
description includes some
7688
89+
group by function \\
90+
task.path.includes('{{query.file.path}}')
91+
=>
92+
group by function task.path.includes('{{query.file.path}}') =>
93+
group by function task.path.includes('sample.md')
94+
7795
group by priority reverse
7896
7997
group by happens
8098
99+
sort by function \\
100+
task.path.includes('{{query.file.path}}')
101+
=>
102+
sort by function task.path.includes('{{query.file.path}}') =>
103+
sort by function task.path.includes('sample.md')
104+
81105
sort by description reverse
82106
83107
sort by path
@@ -95,20 +119,38 @@ limit groups 3
95119
// Disable sort instructions
96120
updateSettings({ debugSettings: new DebugSettings(true) });
97121

98-
const query = new Query(sampleOfAllInstructionTypes);
122+
const query = new Query(sampleOfAllInstructionTypes, new TasksFile('sample.md'));
99123
const indentedExplainer = new Explainer(' ');
100124
expect(indentedExplainer.explainQuery(query)).toMatchInlineSnapshot(`
101-
" not done
125+
" filter by function \\
126+
task.path === '{{query.file.path}}'
127+
=>
128+
filter by function task.path === '{{query.file.path}}' =>
129+
filter by function task.path === 'sample.md'
130+
131+
not done
102132
103133
(has start date) AND (description includes some) =>
104134
AND (All of):
105135
has start date
106136
description includes some
107137
138+
group by function \\
139+
task.path.includes('{{query.file.path}}')
140+
=>
141+
group by function task.path.includes('{{query.file.path}}') =>
142+
group by function task.path.includes('sample.md')
143+
108144
group by priority reverse
109145
110146
group by happens
111147
148+
sort by function \\
149+
task.path.includes('{{query.file.path}}')
150+
=>
151+
sort by function task.path.includes('{{query.file.path}}') =>
152+
sort by function task.path.includes('sample.md')
153+
112154
sort by description reverse
113155
114156
sort by path

0 commit comments

Comments
 (0)