You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
This project uses a combination of unit tests and end-to-end (e2e) tests to ensure correctness and stability.
4
+
5
+
##Unit Testing Patterns
6
+
7
+
- Unit tests are located alongside implementation, with filenames ending in`_test.go`.
8
+
- Currently the preference is to use internal tests i.e. test files do not have`_test` package suffix.
9
+
- Tests use[testify](https://github.com/stretchr/testify) for assertions and require statements. Use`require` when continuing the test is not meaningful, for example it is almost never correct to continue after an error expectation.
10
+
- Mocking is performed using[go-github-mock](https://github.com/migueleliasweb/go-github-mock) or`githubv4mock` for simulating GitHub rest and GQL API responses.
11
+
- Each tool's schema is snapshotted and checked for changes using the`toolsnaps` utility (see below).
12
+
- Tests are designed to be explicit and verbose to aid maintainability and clarity.
13
+
- Handler unit tests should take the form of:
14
+
1. Test tool snapshot
15
+
1. Very important expectations against the schema (e.g.`ReadOnly` annotation)
16
+
1. Behavioural tests in table-driven form
17
+
18
+
##End-to-End (e2e) Tests
19
+
20
+
- E2E tests are located in the[`e2e/`](../e2e/) directory. See the[e2e/README.md](../e2e/README.md) for full details on running and debugging these tests.
21
+
22
+
##toolsnaps: Tool Schema Snapshots
23
+
24
+
- The`toolsnaps` utility ensures that the JSON schema for each tool does not change unexpectedly.
25
+
- Snapshots are stored in`__toolsnaps__/*.snap` files , where`*` represents the name of the tool
26
+
- When running tests, the current tool schema is compared to the snapshot. If there is a difference, the test will fail and show a diff.
27
+
- If you intentionally change a tool's schema, update the snapshots by running tests with the environment variable:`UPDATE_TOOLSNAPS=true go test ./...`
28
+
- In CI (when`GITHUB_ACTIONS=true`), missing snapshots will cause a test failure to ensure snapshots are always
29
+
committed.
30
+
31
+
##Notes
32
+
33
+
- Some tools that mutate global state (e.g., marking all notifications as read) are tested primarily with unit tests, not e2e, to avoid side effects.
34
+
- For more on the limitations and philosophy of the e2e suite, see the[e2e/README.md](../e2e/README.md).
"description":"Get details of the authenticated GitHub user. Use this when a request includes\"me\",\"my\". The output will not change unless the user changes their profile, so only call this once.",
7
+
"inputSchema": {
8
+
"properties": {
9
+
"reason": {
10
+
"description":"Optional: the reason for requesting the user information",