Skip to content

Commit ee684db

Browse files
committed
contrib: Expand the content in 'Structure of the code.md'
1 parent 165fa24 commit ee684db

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

contributing/Code/Structure of the code.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,16 @@ publish: true
44

55
# Structure of the code
66

7+
See how the [[#src/]] and [[#tests/]] directories are structured.
8+
79
## Directory structure
810

911
### src/
1012

13+
The `src/` directory contains the code that **implements** the Tasks plugin.
14+
15+
- [main.ts](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/src/main.ts)
16+
- The `TasksPlugin` class.
1117
- [Api/](https://github.com/obsidian-tasks-group/obsidian-tasks/tree/main/src/Api):
1218
- The [Tasks API](https://publish.obsidian.md/tasks/Advanced/Tasks+Api)
1319
- [Commands/](https://github.com/obsidian-tasks-group/obsidian-tasks/tree/main/src/Commands)
@@ -67,3 +73,25 @@ publish: true
6773
- [Menus/](https://github.com/obsidian-tasks-group/obsidian-tasks/tree/main/src/ui/Menus)
6874
- Various context menus.
6975
- [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`.
76+
77+
### tests/
78+
79+
The `tests/` directory contains the code that **tests** the Tasks plugin, using mechanisms described in [[About Testing]]
80+
81+
Most sub-directories here have the same structure and purpose as their counterparts described above in [[#src/]].
82+
83+
The remainder are:
84+
85+
- [\_\_mocks\_\_/obsidian.ts](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/tests/__mocks__/obsidian.ts)
86+
- Mock implementations of a few types and functions from the Obsidian API.
87+
- [\_\_test_data\_\_/MockDataForTogglingTasks/](https://github.com/obsidian-tasks-group/obsidian-tasks/tree/main/tests/__test_data__/MockDataForTogglingTasks)
88+
- Some data used by [File.test.ts](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/tests/Obsidian/File.test.ts).
89+
- [global-setup.js](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/tests/global-setup.js)
90+
- Enforce all tests to run in UTC time.
91+
- [CustomMatchers/](https://github.com/obsidian-tasks-group/obsidian-tasks/tree/main/tests/CustomMatchers)
92+
- Jest custom matchers for Tasks classes.
93+
- [Obsidian/\_\_test_data\_\_/](https://github.com/obsidian-tasks-group/obsidian-tasks/tree/main/tests/Obsidian/__test_data__)
94+
- JSON files saved from the Obsidian cache, to enable testing against some of the Obsidian API.
95+
- See [[Using Obsidian API in tests]].
96+
- [TestingTools/](https://github.com/obsidian-tasks-group/obsidian-tasks/tree/main/tests/TestingTools)
97+
- Many helper functions to streamling testing.

0 commit comments

Comments
 (0)