Skip to content

Commit 04ad181

Browse files
committed
feat: initial version
1 parent dd36966 commit 04ad181

File tree

5 files changed

+514
-2
lines changed

5 files changed

+514
-2
lines changed

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
TEST_CLIENT_ID=
2+
TEST_CLIENT_SECRET=

bun.lockb

1008 Bytes
Binary file not shown.

index.test.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { expect, test } from "bun:test"
2+
import { ApiV5Client } from "."
3+
import "dotenv/config"
4+
import { z } from "zod"
5+
6+
test("works", async () => {
7+
const client = new ApiV5Client({
8+
apiBase: "api.helloasso.com",
9+
clientId: process.env.TEST_CLIENT_ID!,
10+
clientSecret: process.env.TEST_CLIENT_SECRET!,
11+
logger: () => ({}),
12+
})
13+
const result = await client
14+
.call("/v5/users/me/organizations")
15+
.then((r) => r.json())
16+
expect(
17+
z
18+
.array(
19+
z.object({
20+
name: z.string(),
21+
role: z.string(),
22+
city: z.string(),
23+
zipCode: z.string(),
24+
updateDate: z.string(),
25+
url: z.string().url(),
26+
organizationSlug: z.string(),
27+
})
28+
)
29+
.parse(result)
30+
).toEqual(result)
31+
})

0 commit comments

Comments
 (0)