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
feat(nodejs): add folder API support and live e2e coverage (#52)
Extend the Node.js client with user and team folder APIs, folder-aware note
options, and exported folder types. Add an opt-in live e2e test suite and keep
non-idempotent retries from masking server-side POST failures.
Made-with: Cursor
See the [code](./src/index.ts) and [typings](./src/type.ts). The API client is written in TypeScript, so you can get auto-completion and type checking in any TypeScript Language Server powered editor or IDE.
123
123
124
+
## E2E tests (live API)
125
+
126
+
Integration tests call a real HackMD API (staging or production). They are **not** run by `npm test` or the default CI job.
127
+
128
+
**Requirements**
129
+
130
+
-`HACKMD_ACCESS_TOKEN` — a valid personal access token for the environment you target.
131
+
- Optional: `HACKMD_API_ENDPOINT` — defaults to `https://api.hackmd.io/v1`. For staging, use `https://api-stage.hackmd.io/v1`.
Set `HACKMD_E2E_MUTATIONS=1` to run write tests against your account:
145
+
146
+
-**Notes:** create → get → update (title, content, tags) → list → delete.
147
+
-**Folders:** one integration test runs create (root + nested) → get → update → list → folder-order round-trip (skipped if that API returns 404) → delete. If **POST `/folders`** returns 404 (common before full production rollout), the test exits early with a warning; use staging or `HACKMD_E2E_FOLDERS=0`.
148
+
149
+
```bash
150
+
HACKMD_E2E_MUTATIONS=1 npm run test:e2e
151
+
```
152
+
153
+
Folder CRUD touches folder display order briefly, then restores the previous order in an `afterAll` hook. To skip folder mutations (e.g. production without `/folders`), set `HACKMD_E2E_FOLDERS=0`.
154
+
155
+
The read-only `getFolderList` test still treats HTTP 404 as “folders not available on this host yet” and passes without failing the suite.
0 commit comments