Skip to content

Commit e770f0b

Browse files
committed
test: Improve names of 'describe' and 'it' blocks
1 parent c9c57fc commit e770f0b

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

tests/Scripting/QueryContext.test.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,42 @@ import { makeQueryContext } from '../../src/Scripting/QueryContext';
77
import { FunctionField } from '../../src/Query/Filter/FunctionField';
88
import { SearchInfo } from '../../src/Query/SearchInfo';
99

10+
const path = 'a/b/c.md';
11+
const task = new TaskBuilder().path(path).build();
12+
const queryContext = makeQueryContext(path);
13+
1014
describe('QueryContext', () => {
1115
describe('values should all match their corresponding filters', () => {
12-
const path = 'a/b/c.md';
13-
const task = new TaskBuilder().path(path).build();
14-
const queryContext = makeQueryContext(path);
15-
16-
it('root', () => {
16+
it('query.file.root', () => {
1717
const instruction = `root includes ${queryContext.query.file.root}`;
1818
const filter = new RootField().createFilterOrErrorMessage(instruction);
1919
expect(filter).toMatchTask(task);
2020
});
2121

22-
it('path', () => {
22+
it('query.file.path', () => {
2323
const instruction = `path includes ${queryContext.query.file.path}`;
2424
const filter = new PathField().createFilterOrErrorMessage(instruction);
2525
expect(filter).toMatchTask(task);
2626
});
2727

28-
it('folder', () => {
28+
it('query.file.folder', () => {
2929
const instruction = `folder includes ${queryContext.query.file.folder}`;
3030
const filter = new FolderField().createFilterOrErrorMessage(instruction);
3131
expect(filter).toMatchTask(task);
3232
});
3333

34-
it('filename', () => {
34+
it('query.file.filename', () => {
3535
const instruction = `filename includes ${queryContext.query.file.filename}`;
3636
const filter = new FilenameField().createFilterOrErrorMessage(instruction);
3737
expect(filter).toMatchTask(task);
3838
});
39+
});
3940

40-
it('allTasks', () => {
41+
describe('non-file properties', () => {
42+
it('query.allTasks', () => {
4143
// Arrange
42-
// An artificial example, just to demonstrate that query.allTasks is accessible via scripting
44+
// An artificial example, just to demonstrate that query.allTasks is accessible via scripting,
45+
// when the SearchInfo parameter is converted to a QueryContext.
4346
const instruction = 'group by function query.allTasks.length';
4447
const grouper = new FunctionField().createGrouperFromLine(instruction);
4548
expect(grouper).not.toBeNull();

0 commit comments

Comments
 (0)