chore: switch package manager to bun and create docs for codebase

This commit is contained in:
Tasnim Kabir Sadik
2026-05-16 17:27:47 +06:00
parent b35df41f08
commit a69118aa2d
16 changed files with 1008 additions and 2360 deletions

View File

@ -1,7 +1,7 @@
import { beforeAll, describe, expect, it } from "vitest";
import { WrennClient } from "../../src/client.js";
import { DEFAULT_BASE_URL } from "../../src/config.js";
import { type ClientConfig, DEFAULT_BASE_URL } from "../../src/config.js";
const baseUrl = process.env.WRENN_BASE_URL ?? DEFAULT_BASE_URL;
const apiKey = process.env.WRENN_API_KEY;
@ -11,8 +11,11 @@ const testPassword = process.env.WRENN_TEST_PASS;
const describeWithApiKey = apiKey ? describe : describe.skip;
const describeWithLogin = testEmail && testPassword ? describe : describe.skip;
const apiKeyClientOpts: ClientConfig = { baseUrl };
if (apiKey) apiKeyClientOpts.apiKey = apiKey;
describeWithApiKey("WrennClient live API key integration", () => {
const client = new WrennClient({ apiKey, baseUrl });
const client = new WrennClient(apiKeyClientOpts);
it("lists capsules from the real Wrenn API", async () => {
const capsules = await client.capsules.list();
@ -50,7 +53,9 @@ describeWithLogin("WrennClient live login integration", () => {
});
expect(auth.token).toBeTypeOf("string");
client = new WrennClient({ baseUrl, token: auth.token });
const token = auth.token;
if (!token) throw new Error("Login response did not include a token");
client = new WrennClient({ baseUrl, token });
});
it("gets the current account profile from the real Wrenn API", async () => {