generated from obsidianmd/obsidian-sample-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2373 from obsidian-tasks-group/add-search-info-class
refactor: Introduce (empty) SearchInfo class
- Loading branch information
Showing
11 changed files
with
73 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* SearchInfo will soon contain selected data passed in from the {@link Query} being executed. | ||
* | ||
* This is the Parameter Object pattern: it is a container for information that will | ||
* be passed down through multiple levels of code, in order to be able to in future | ||
* pass through more data, without having to update the function signatures of all | ||
* the layers in between. | ||
*/ | ||
export class SearchInfo {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { SearchInfo } from '../../src/Query/SearchInfo'; | ||
import type { Task } from '../../src/Task'; | ||
import { TaskBuilder } from '../TestingTools/TaskBuilder'; | ||
import { FilterOrErrorMessage } from '../../src/Query/Filter/FilterOrErrorMessage'; | ||
import { Filter } from '../../src/Query/Filter/Filter'; | ||
import { Explanation } from '../../src/Query/Explain/Explanation'; | ||
|
||
describe('CustomMatchersForFilters', () => { | ||
it('should check filter with supplied SearchInfo', () => { | ||
// Arrange | ||
const initialSearchInfo = new SearchInfo(); | ||
const checkSearchInfoPassedThrough = (_task: Task, searchInfo: SearchInfo) => { | ||
return Object.is(initialSearchInfo, searchInfo); | ||
}; | ||
const filter = FilterOrErrorMessage.fromFilter( | ||
new Filter('stuff', checkSearchInfoPassedThrough, new Explanation('explanation of stuff')), | ||
); | ||
|
||
// Act, Assert | ||
expect(filter).toMatchTaskWithSearchInfo(new TaskBuilder().build(), initialSearchInfo); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters