@@ -5,12 +5,15 @@ import { MarkdownTable } from '../../src/lib/MarkdownTable';
55import { parseAndEvaluateExpression } from '../../src/Scripting/TaskExpression' ;
66import { TaskBuilder } from '../TestingTools/TaskBuilder' ;
77import { TasksFile } from '../../src/Scripting/TasksFile' ;
8+ import { getTasksFileFromMockData } from '../TestingTools/MockDataHelpers' ;
9+ import query_using_properties from '../Obsidian/__test_data__/query_using_properties.json' ;
810import { addBackticks , determineExpressionType , formatToRepresentType } from './ScriptingTestHelpers' ;
911
1012describe ( 'query' , ( ) => {
1113 function verifyFieldDataForReferenceDocs ( fields : string [ ] ) {
1214 const markdownTable = new MarkdownTable ( [ 'Field' , 'Type' , 'Example' ] ) ;
13- const tasksFile = new TasksFile ( 'root/sub-folder/file containing query.md' ) ;
15+ const cachedMetadata = getTasksFileFromMockData ( query_using_properties ) . cachedMetadata ;
16+ const tasksFile = new TasksFile ( 'root/sub-folder/file containing query.md' , cachedMetadata ) ;
1417 const task = new TaskBuilder ( )
1518 . description ( '... an array with all the Tasks-tracked tasks in the vault ...' )
1619 . build ( ) ;
@@ -35,6 +38,10 @@ describe('query', () => {
3538 'query.file.folder' ,
3639 'query.file.filename' ,
3740 'query.file.filenameWithoutExtension' ,
41+ "query.file.hasProperty('task_instruction')" ,
42+ "query.file.hasProperty('non_existent_property')" ,
43+ "query.file.property('task_instruction')" ,
44+ "query.file.property('non_existent_property')" ,
3845 ] ) ;
3946 } ) ;
4047
0 commit comments