diff --git a/contributing/Code/Structure of the code.md b/contributing/Code/Structure of the code.md index e5d9ac6f0f..b67cab2221 100644 --- a/contributing/Code/Structure of the code.md +++ b/contributing/Code/Structure of the code.md @@ -4,10 +4,16 @@ publish: true # Structure of the code +See how the [[#src/]] and [[#tests/]] directories are structured. + ## Directory structure ### src/ +The `src/` directory contains the code that **implements** the Tasks plugin. + +- [main.ts](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/src/main.ts) + - The `TasksPlugin` class. - [Api/](https://github.com/obsidian-tasks-group/obsidian-tasks/tree/main/src/Api): - The [Tasks API](https://publish.obsidian.md/tasks/Advanced/Tasks+Api) - [Commands/](https://github.com/obsidian-tasks-group/obsidian-tasks/tree/main/src/Commands) @@ -67,3 +73,25 @@ publish: true - [Menus/](https://github.com/obsidian-tasks-group/obsidian-tasks/tree/main/src/ui/Menus) - Various context menus. - [TaskEditingMenu](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/src/ui/Menus/TaskEditingMenu.ts) is an abstraction for context menus on a Task instance, based upon `TaskEditingInstruction`. + +### tests/ + +The `tests/` directory contains the code that **tests** the Tasks plugin, using mechanisms described in [[About Testing]] + +Most sub-directories here have the same structure and purpose as their counterparts described above in [[#src/]]. + +The remainder are: + +- [\_\_mocks\_\_/obsidian.ts](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/tests/__mocks__/obsidian.ts) + - Mock implementations of a few types and functions from the Obsidian API. +- [\_\_test_data\_\_/MockDataForTogglingTasks/](https://github.com/obsidian-tasks-group/obsidian-tasks/tree/main/tests/__test_data__/MockDataForTogglingTasks) + - Some data used by [File.test.ts](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/tests/Obsidian/File.test.ts). +- [global-setup.js](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/tests/global-setup.js) + - Enforce all tests to run in UTC time. +- [CustomMatchers/](https://github.com/obsidian-tasks-group/obsidian-tasks/tree/main/tests/CustomMatchers) + - Jest custom matchers for Tasks classes. +- [Obsidian/\_\_test_data\_\_/](https://github.com/obsidian-tasks-group/obsidian-tasks/tree/main/tests/Obsidian/__test_data__) + - JSON files saved from the Obsidian cache, to enable testing against some of the Obsidian API. + - See [[Using Obsidian API in tests]]. +- [TestingTools/](https://github.com/obsidian-tasks-group/obsidian-tasks/tree/main/tests/TestingTools) + - Many helper functions to streamling testing.