Skip to content

Commit

Permalink
contrib: Expand the content in 'Structure of the code.md'
Browse files Browse the repository at this point in the history
  • Loading branch information
claremacrae committed Dec 8, 2024
1 parent 165fa24 commit ee684db
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions contributing/Code/Structure of the code.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.

0 comments on commit ee684db

Please sign in to comment.